fix suggest piece bug

This commit is contained in:
Arvid Norberg 2011-03-15 01:58:48 +00:00
parent 7dde47b98a
commit f9f5e3138c
2 changed files with 5 additions and 0 deletions

View File

@ -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;
}

View File

@ -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);