forked from premiere/premiere-libtorrent
fixed sequenced download bug
This commit is contained in:
parent
57471d4b37
commit
f029f5d6b2
|
@ -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 an integer overflow bug occuring when built with gcc 4.1.x
|
||||||
* fixed crasing bug when closing while checking a torrent
|
* fixed crasing bug when closing while checking a torrent
|
||||||
* fixed bug causing a crash with a torrent with piece length 0
|
* fixed bug causing a crash with a torrent with piece length 0
|
||||||
|
|
|
@ -166,20 +166,25 @@ namespace libtorrent
|
||||||
|
|
||||||
if (old_limit < sequenced_download_threshold)
|
if (old_limit < sequenced_download_threshold)
|
||||||
{
|
{
|
||||||
assert(int(m_piece_info.size()) > old_limit);
|
// the threshold was incremented, in case
|
||||||
info_t& in = m_piece_info[old_limit];
|
// the previous max availability was reached
|
||||||
std::random_shuffle(in.begin(), in.end());
|
// we need to shuffle that bucket, if not, we
|
||||||
int c = 0;
|
// don't have to do anything
|
||||||
for (info_t::iterator i = in.begin()
|
if (int(m_piece_info.size()) > old_limit)
|
||||||
, end(in.end()); i != end; ++i)
|
|
||||||
{
|
{
|
||||||
m_piece_map[*i].index = c++;
|
info_t& in = m_piece_info[old_limit];
|
||||||
assert(m_piece_map[*i].priority(old_limit) == old_limit);
|
std::random_shuffle(in.begin(), in.end());
|
||||||
|
int c = 0;
|
||||||
|
for (info_t::iterator i = in.begin()
|
||||||
|
, end(in.end()); i != end; ++i)
|
||||||
|
{
|
||||||
|
m_piece_map[*i].index = c++;
|
||||||
|
assert(m_piece_map[*i].priority(old_limit) == old_limit);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (int(m_piece_info.size()) > sequenced_download_threshold)
|
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];
|
info_t& in = m_piece_info[sequenced_download_threshold];
|
||||||
std::sort(in.begin(), in.end());
|
std::sort(in.begin(), in.end());
|
||||||
int c = 0;
|
int c = 0;
|
||||||
|
|
Loading…
Reference in New Issue