mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-15 01:33:07 -07:00
- Fixed an overflow that could cause ETA to become negative sometimes (hitted an assert)
This commit is contained in:
parent
925ecb3464
commit
3cb34ed7ee
2 changed files with 7 additions and 6 deletions
|
@ -160,13 +160,14 @@ void bittorrent::updateETAs() {
|
|||
unsigned int nbETAs = listEtas.size();
|
||||
Q_ASSERT(nbETAs);
|
||||
foreach(val, listEtas) {
|
||||
// TODO: Remove this debug when #137223 is fixed
|
||||
qDebug("old moy: %ld", (long)moy);
|
||||
moy += (qlonglong)((double)val/(double)nbETAs);
|
||||
qDebug("ETA: %ld, nbETAs: %d, moy: %ld", (long)val, nbETAs, (long)moy);
|
||||
Q_ASSERT(moy >= 0);
|
||||
if(moy < 0) break;
|
||||
}
|
||||
if(moy < 0) {
|
||||
ETAs.remove(hash);
|
||||
} else {
|
||||
ETAs[hash] = moy;
|
||||
}
|
||||
ETAs[hash] = moy;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue