made downloading pieces higher priority. fix in piece picker when blocks in prio 0 pieces were marked as finished

This commit is contained in:
Arvid Norberg 2007-04-17 09:21:53 +00:00
parent 849db39472
commit 067219d14a
2 changed files with 3 additions and 2 deletions

View File

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

View File

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