mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-22 20:44:15 +00:00
Fix weird ratio values when torrent was imported or downloaded history was lost due to crash.
This commit is contained in:
parent
f99f5f5c7e
commit
9714b2ede9
@ -1552,9 +1552,15 @@ qreal QBtSession::getRealRatio(const QString &hash) 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();
|
libtorrent::size_type all_time_download = h.all_time_download();
|
||||||
if (all_time_download == 0 && h.is_seed()) {
|
libtorrent::size_type total_done = h.total_done();
|
||||||
// Purely seeded torrent
|
if (all_time_download < total_done) {
|
||||||
all_time_download = h.total_done();
|
// We have more data on disk than we downloaded
|
||||||
|
// either because the user imported the file
|
||||||
|
// or because of crash the download histroy was lost.
|
||||||
|
// Otherwise will get weird ratios
|
||||||
|
// eg when downloaded 1KB and uploaded 700MB of a
|
||||||
|
// 700MB torrent.
|
||||||
|
all_time_download = total_done;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (all_time_download == 0) {
|
if (all_time_download == 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user