fixed sequenced download bug

This commit is contained in:
Arvid Norberg 2006-10-02 08:58:28 +00:00
parent 57471d4b37
commit f029f5d6b2
2 changed files with 16 additions and 9 deletions

View File

@ -1,3 +1,5 @@
* fixed bug occuring when increasing the sequenced download threshold
with max availability lower than previous threshold.
* fixed an integer overflow bug occuring when built with gcc 4.1.x
* fixed crasing bug when closing while checking a torrent
* fixed bug causing a crash with a torrent with piece length 0

View File

@ -166,7 +166,12 @@ namespace libtorrent
if (old_limit < sequenced_download_threshold)
{
assert(int(m_piece_info.size()) > old_limit);
// the threshold was incremented, in case
// the previous max availability was reached
// we need to shuffle that bucket, if not, we
// don't have to do anything
if (int(m_piece_info.size()) > old_limit)
{
info_t& in = m_piece_info[old_limit];
std::random_shuffle(in.begin(), in.end());
int c = 0;
@ -177,9 +182,9 @@ namespace libtorrent
assert(m_piece_map[*i].priority(old_limit) == old_limit);
}
}
}
else if (int(m_piece_info.size()) > sequenced_download_threshold)
{
assert(int(m_piece_info.size()) > sequenced_download_threshold);
info_t& in = m_piece_info[sequenced_download_threshold];
std::sort(in.begin(), in.end());
int c = 0;