From 60ddb5c64a3fc925606f8c52e00fd899eca58151 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Wed, 18 Apr 2007 20:40:41 +0000 Subject: [PATCH] piece_picker fix --- include/libtorrent/piece_picker.hpp | 2 +- src/piece_picker.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/libtorrent/piece_picker.hpp b/include/libtorrent/piece_picker.hpp index 2fe8b71fa..b4009ee54 100755 --- a/include/libtorrent/piece_picker.hpp +++ b/include/libtorrent/piece_picker.hpp @@ -286,7 +286,7 @@ namespace libtorrent { if (filtered() || have()) return 0; // 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 (prio <= 1) return prio; if (prio >= limit * 2) prio = limit * 2; diff --git a/src/piece_picker.cpp b/src/piece_picker.cpp index 44f860282..af9b6977c 100755 --- a/src/piece_picker.cpp +++ b/src/piece_picker.cpp @@ -1240,7 +1240,7 @@ namespace libtorrent { p.downloading = 1; if (prio > 0) move(prio, p.index); - else add(block.piece_index); + else assert(p.priority(m_sequenced_download_threshold) == 0); downloading_piece dp; dp.index = block.piece_index;