mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-02-03 10:25:02 +00:00
- Fixed overflow handling in ETA calculation
This commit is contained in:
parent
70f8a00c20
commit
f75501f781
@ -166,8 +166,16 @@ void bittorrent::updateETAs() {
|
|||||||
foreach(val, listEtas) {
|
foreach(val, listEtas) {
|
||||||
moy += (qlonglong)((double)val/(double)nbETAs);
|
moy += (qlonglong)((double)val/(double)nbETAs);
|
||||||
}
|
}
|
||||||
Q_ASSERT(moy >= 0);
|
if(moy < 0) {
|
||||||
ETAs[hash] = moy;
|
if(ETAstats.contains(hash)) {
|
||||||
|
ETAstats.remove(hash);
|
||||||
|
}
|
||||||
|
if(ETAs.contains(hash)) {
|
||||||
|
ETAs.remove(hash);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ETAs[hash] = moy;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// Speed is too low, we don't want an overflow.
|
// Speed is too low, we don't want an overflow.
|
||||||
if(ETAstats.contains(hash)) {
|
if(ETAstats.contains(hash)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user