mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-14 02:27:09 -07:00
- Fixed overflow handling in ETA calculation
This commit is contained in:
parent
70f8a00c20
commit
f75501f781
1 changed files with 10 additions and 2 deletions
|
@ -166,8 +166,16 @@ void bittorrent::updateETAs() {
|
|||
foreach(val, listEtas) {
|
||||
moy += (qlonglong)((double)val/(double)nbETAs);
|
||||
}
|
||||
Q_ASSERT(moy >= 0);
|
||||
ETAs[hash] = moy;
|
||||
if(moy < 0) {
|
||||
if(ETAstats.contains(hash)) {
|
||||
ETAstats.remove(hash);
|
||||
}
|
||||
if(ETAs.contains(hash)) {
|
||||
ETAs.remove(hash);
|
||||
}
|
||||
} else {
|
||||
ETAs[hash] = moy;
|
||||
}
|
||||
} else {
|
||||
// Speed is too low, we don't want an overflow.
|
||||
if(ETAstats.contains(hash)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue