fix one more issue with end-game mode when some pieces that are no longer selected for download have been downloaded

This commit is contained in:
Arvid Norberg 2012-07-02 03:27:32 +00:00
parent 7332f6b219
commit 1c2b7471cb
2 changed files with 4 additions and 8 deletions

View File

@ -341,6 +341,9 @@ namespace libtorrent
int num_have() const { return m_num_have; } int num_have() const { return m_num_have; }
// the number of pieces we want and don't have
int num_want_left() const { return num_pieces() - m_num_have - m_num_filtered; }
#ifdef TORRENT_DEBUG #ifdef TORRENT_DEBUG
// used in debug mode // used in debug mode
void verify_priority(int start, int end, int prio) const; void verify_priority(int start, int end, int prio) const;

View File

@ -236,15 +236,8 @@ namespace libtorrent
// and we're not strictly speaking in end-game mode yet // and we're not strictly speaking in end-game mode yet
// also, if we already have at least one outstanding // also, if we already have at least one outstanding
// request, we shouldn't pick any busy pieces either // request, we shouldn't pick any busy pieces either
// the number of pieces we want (i.e. not including the filtered pieces)
int num_want = t.torrent_file().num_pieces() - p.num_filtered();
// the number of pieces we already have (not counting pieces that are filtered
// that we might have still for some reason)
int num_have = p.num_have() - p.num_have_filtered();
bool dont_pick_busy_blocks = (ses.m_settings.strict_end_game_mode bool dont_pick_busy_blocks = (ses.m_settings.strict_end_game_mode
&& num_have + p.num_downloading_pieces() < num_want) && p.num_downloading_pieces() < p.num_want_left())
|| dq.size() + rq.size() > 0; || dq.size() + rq.size() > 0;
// this is filled with an interesting piece // this is filled with an interesting piece