fix division by zero in super-seeding logic
This commit is contained in:
parent
2e66708273
commit
71e3fb8941
|
@ -86,6 +86,8 @@
|
||||||
* almost completely changed the storage interface (for custom storage)
|
* almost completely changed the storage interface (for custom storage)
|
||||||
* added support for hashing pieces in multiple threads
|
* added support for hashing pieces in multiple threads
|
||||||
|
|
||||||
|
* fix division by zero in super-seeding logic
|
||||||
|
|
||||||
1.0.9 release
|
1.0.9 release
|
||||||
|
|
||||||
* fix issue in checking outgoing interfaces (when that option is enabled)
|
* fix issue in checking outgoing interfaces (when that option is enabled)
|
||||||
|
|
|
@ -5002,6 +5002,9 @@ namespace libtorrent
|
||||||
// seeded by any peer
|
// seeded by any peer
|
||||||
TORRENT_ASSERT(m_super_seeding);
|
TORRENT_ASSERT(m_super_seeding);
|
||||||
|
|
||||||
|
if (!need_loaded())
|
||||||
|
return -1;
|
||||||
|
|
||||||
// do a linear search from the first piece
|
// do a linear search from the first piece
|
||||||
int min_availability = 9999;
|
int min_availability = 9999;
|
||||||
std::vector<int> avail_vec;
|
std::vector<int> avail_vec;
|
||||||
|
@ -5034,6 +5037,7 @@ namespace libtorrent
|
||||||
avail_vec.push_back(i);
|
avail_vec.push_back(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (avail_vec.empty()) return -1;
|
||||||
return avail_vec[random() % avail_vec.size()];
|
return avail_vec[random() % avail_vec.size()];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue