mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-21 05:43:32 -07:00
Fix ratio calculation for purely seeded torrents
(cherry picked from commit 422b483d78
)
This commit is contained in:
parent
5b576baf67
commit
79a9606e86
2 changed files with 9 additions and 2 deletions
|
@ -1,4 +1,5 @@
|
||||||
* Unreleased - Christophe Dumez <chris@qbittorrent.org> - v2.9.1
|
* Unreleased - Christophe Dumez <chris@qbittorrent.org> - v2.9.1
|
||||||
|
- BUGFIX: Fix ratio calculation for purely seeded torrents
|
||||||
- I18N: Update Russian translation
|
- I18N: Update Russian translation
|
||||||
|
|
||||||
* Sat Oct 08 2011 - Christophe Dumez <chris@qbittorrent.org> - v2.9.0
|
* Sat Oct 08 2011 - Christophe Dumez <chris@qbittorrent.org> - v2.9.0
|
||||||
|
|
|
@ -1587,14 +1587,20 @@ qreal QBtSession::getRealRatio(const QString &hash) const{
|
||||||
if(!h.is_valid()) {
|
if(!h.is_valid()) {
|
||||||
return 0.;
|
return 0.;
|
||||||
}
|
}
|
||||||
const libtorrent::size_type all_time_download = h.all_time_download();
|
|
||||||
const libtorrent::size_type all_time_upload = h.all_time_upload();
|
libtorrent::size_type all_time_upload = h.all_time_upload();
|
||||||
|
libtorrent::size_type all_time_download = h.all_time_download();
|
||||||
|
if (all_time_download == 0 && h.is_seed()) {
|
||||||
|
// Purely seeded torrent
|
||||||
|
all_time_download = h.total_done();
|
||||||
|
}
|
||||||
|
|
||||||
if(all_time_download == 0) {
|
if(all_time_download == 0) {
|
||||||
if(all_time_upload == 0)
|
if(all_time_upload == 0)
|
||||||
return 0;
|
return 0;
|
||||||
return MAX_RATIO+1;
|
return MAX_RATIO+1;
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal ratio = all_time_upload / (float) all_time_download;
|
qreal ratio = all_time_upload / (float) all_time_download;
|
||||||
Q_ASSERT(ratio >= 0.);
|
Q_ASSERT(ratio >= 0.);
|
||||||
if(ratio > MAX_RATIO)
|
if(ratio > MAX_RATIO)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue