piece_picker fix

This commit is contained in:
Arvid Norberg 2007-04-18 20:40:41 +00:00
parent 9551e68074
commit 60ddb5c64a
2 changed files with 2 additions and 2 deletions

View File

@ -286,7 +286,7 @@ namespace libtorrent
{ {
if (filtered() || have()) return 0; if (filtered() || have()) return 0;
// pieces we are currently downloading have high priority // pieces we are currently downloading have high priority
int prio = downloading ? 1 : peer_count * 2; int prio = downloading ? (std::min)(1, int(peer_count)) : peer_count * 2;
// if the peer_count is 0 or 1, the priority cannot be higher // if the peer_count is 0 or 1, the priority cannot be higher
if (prio <= 1) return prio; if (prio <= 1) return prio;
if (prio >= limit * 2) prio = limit * 2; if (prio >= limit * 2) prio = limit * 2;

View File

@ -1240,7 +1240,7 @@ namespace libtorrent
{ {
p.downloading = 1; p.downloading = 1;
if (prio > 0) move(prio, p.index); if (prio > 0) move(prio, p.index);
else add(block.piece_index); else assert(p.priority(m_sequenced_download_threshold) == 0);
downloading_piece dp; downloading_piece dp;
dp.index = block.piece_index; dp.index = block.piece_index;