fixed rare piece picker bug
This commit is contained in:
parent
44ace0b86b
commit
8454d51ba1
|
@ -72,6 +72,7 @@ release 0.14.5
|
||||||
* fixed bug in rename_file(). The new name would not always be saved in
|
* fixed bug in rename_file(). The new name would not always be saved in
|
||||||
the resume data
|
the resume data
|
||||||
* fixed resume data compatibility with 0.13
|
* fixed resume data compatibility with 0.13
|
||||||
|
* fixed rare piece-picker bug
|
||||||
|
|
||||||
release 0.14.4
|
release 0.14.4
|
||||||
|
|
||||||
|
|
|
@ -1502,9 +1502,9 @@ namespace libtorrent
|
||||||
// skip pieces we can't pick, and suggested pieces
|
// skip pieces we can't pick, and suggested pieces
|
||||||
// since we've already picked those
|
// since we've already picked those
|
||||||
while (!can_pick(piece, pieces)
|
while (!can_pick(piece, pieces)
|
||||||
&& std::find(suggested_pieces.begin()
|
|| std::find(suggested_pieces.begin()
|
||||||
, suggested_pieces.end(), piece)
|
, suggested_pieces.end(), piece)
|
||||||
== suggested_pieces.end())
|
!= suggested_pieces.end())
|
||||||
{
|
{
|
||||||
++piece;
|
++piece;
|
||||||
if (piece == int(m_piece_map.size())) piece = 0;
|
if (piece == int(m_piece_map.size())) piece = 0;
|
||||||
|
@ -1513,11 +1513,14 @@ namespace libtorrent
|
||||||
}
|
}
|
||||||
if (done) break;
|
if (done) break;
|
||||||
|
|
||||||
|
TORRENT_ASSERT(can_pick(piece, pieces));
|
||||||
|
TORRENT_ASSERT(m_piece_map[piece].downloading == false);
|
||||||
|
|
||||||
int start, end;
|
int start, end;
|
||||||
boost::tie(start, end) = expand_piece(piece, prefer_whole_pieces, pieces);
|
boost::tie(start, end) = expand_piece(piece, prefer_whole_pieces, pieces);
|
||||||
for (int k = start; k < end; ++k)
|
for (int k = start; k < end; ++k)
|
||||||
{
|
{
|
||||||
TORRENT_ASSERT(m_piece_map[piece].downloading == false);
|
TORRENT_ASSERT(m_piece_map[k].downloading == false);
|
||||||
TORRENT_ASSERT(m_piece_map[k].priority(this) >= 0);
|
TORRENT_ASSERT(m_piece_map[k].priority(this) >= 0);
|
||||||
int num_blocks_in_piece = blocks_in_piece(k);
|
int num_blocks_in_piece = blocks_in_piece(k);
|
||||||
if (prefer_whole_pieces == 0 && num_blocks_in_piece > num_blocks)
|
if (prefer_whole_pieces == 0 && num_blocks_in_piece > num_blocks)
|
||||||
|
|
Loading…
Reference in New Issue