fix suggest piece bug
This commit is contained in:
parent
7dde47b98a
commit
f9f5e3138c
|
@ -3002,7 +3002,10 @@ namespace libtorrent
|
|||
t->get_suggested_pieces(ret);
|
||||
for (std::vector<int>::iterator i = ret.begin()
|
||||
, end(ret.end()); i != end; ++i)
|
||||
{
|
||||
TORRENT_ASSERT(*i >= 0);
|
||||
send_suggest(*i);
|
||||
}
|
||||
|
||||
m_sent_suggests = true;
|
||||
}
|
||||
|
|
|
@ -6825,6 +6825,8 @@ namespace libtorrent
|
|||
// if we have an explicit cache, it's much more likely to
|
||||
// stick around, so we should suggest all pieces
|
||||
int num_pieces_to_suggest = int(ret.size());
|
||||
if (num_pieces_to_suggest == 0) return;
|
||||
|
||||
if (!settings().explicit_read_cache)
|
||||
num_pieces_to_suggest = (std::max)(1, int(ret.size() / 2));
|
||||
ret.resize(num_pieces_to_suggest);
|
||||
|
|
Loading…
Reference in New Issue