mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-11 07:18:08 +00:00
- BUGFIX: Fixed possible overflow in ETA calculation
This commit is contained in:
parent
9bb18e1a07
commit
f754e34e35
1
TODO
1
TODO
@ -62,3 +62,4 @@ rc4->rc5 changelog:
|
|||||||
- BUGFIX: Now filtered don't appear on hard drive anymore (libtorrent >= r1659)
|
- BUGFIX: Now filtered don't appear on hard drive anymore (libtorrent >= r1659)
|
||||||
- BUGFIX: AddInPause setting doesn't pause downloads on startup anymore
|
- BUGFIX: AddInPause setting doesn't pause downloads on startup anymore
|
||||||
- BUGFIX: Fixed an ETA calculation problem when the torrent has filtered files
|
- BUGFIX: Fixed an ETA calculation problem when the torrent has filtered files
|
||||||
|
- BUGFIX: Fixed possible overflow in ETA calculation
|
@ -147,7 +147,9 @@ void bittorrent::updateETAs() {
|
|||||||
if(listEtas.size() == ETAS_MAX_VALUES) {
|
if(listEtas.size() == ETAS_MAX_VALUES) {
|
||||||
listEtas.removeFirst();
|
listEtas.removeFirst();
|
||||||
}
|
}
|
||||||
if(h.download_payload_rate()) {
|
// XXX: We can still get an overflow if remaining file size is approximately
|
||||||
|
// 8.38*10^5 TiB (lets assume this can't happen)
|
||||||
|
if(h.download_payload_rate() > 0.1) {
|
||||||
listEtas << (qlonglong)((h.actual_size()-h.total_wanted_done())/(double)h.download_payload_rate());
|
listEtas << (qlonglong)((h.actual_size()-h.total_wanted_done())/(double)h.download_payload_rate());
|
||||||
ETAstats[hash] = listEtas;
|
ETAstats[hash] = listEtas;
|
||||||
qlonglong moy = 0;
|
qlonglong moy = 0;
|
||||||
@ -156,12 +158,16 @@ void bittorrent::updateETAs() {
|
|||||||
Q_ASSERT(nbETAs);
|
Q_ASSERT(nbETAs);
|
||||||
foreach(val, listEtas) {
|
foreach(val, listEtas) {
|
||||||
moy += (qlonglong)((double)val/(double)nbETAs);
|
moy += (qlonglong)((double)val/(double)nbETAs);
|
||||||
if(moy < 0) break;
|
Q_ASSERT(moy >= 0);
|
||||||
}
|
}
|
||||||
if(moy < 0) {
|
|
||||||
ETAs.remove(hash);
|
|
||||||
} else {
|
|
||||||
ETAs[hash] = moy;
|
ETAs[hash] = moy;
|
||||||
|
} else {
|
||||||
|
// Speed is too low, we don't want overflow.
|
||||||
|
if(ETAstats.contains(hash)) {
|
||||||
|
ETAs.remove(hash);
|
||||||
|
}
|
||||||
|
if(ETAs.contains(hash)) {
|
||||||
|
ETAs.remove(hash);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ TARGET = qbittorrent
|
|||||||
CONFIG += qt thread x11 network
|
CONFIG += qt thread x11 network
|
||||||
|
|
||||||
# Update this VERSION for each release
|
# Update this VERSION for each release
|
||||||
DEFINES += VERSION=\\\"v1.0.0rc4\\\"
|
DEFINES += VERSION=\\\"v1.0.0rc5\\\"
|
||||||
DEFINES += VERSION_MAJOR=1
|
DEFINES += VERSION_MAJOR=1
|
||||||
DEFINES += VERSION_MINOR=0
|
DEFINES += VERSION_MINOR=0
|
||||||
DEFINES += VERSION_BUGFIX=0
|
DEFINES += VERSION_BUGFIX=0
|
||||||
|
Loading…
Reference in New Issue
Block a user