fix invariant check
This commit is contained in:
@@ -215,6 +215,15 @@ namespace libtorrent
|
|||||||
return m_piece_map[index].index == piece_pos::we_have_index;
|
return m_piece_map[index].index == piece_pos::we_have_index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool is_downloading(int index) const
|
||||||
|
{
|
||||||
|
TORRENT_ASSERT(index >= 0);
|
||||||
|
TORRENT_ASSERT(index < int(m_piece_map.size()));
|
||||||
|
|
||||||
|
piece_pos const& p = m_piece_map[index];
|
||||||
|
return p.downloading;
|
||||||
|
}
|
||||||
|
|
||||||
// sets the priority of a piece.
|
// sets the priority of a piece.
|
||||||
// returns true if the priority was changed from 0 to non-0
|
// returns true if the priority was changed from 0 to non-0
|
||||||
// or vice versa
|
// or vice versa
|
||||||
|
@@ -6485,7 +6485,12 @@ namespace libtorrent
|
|||||||
piece_block b = i->first;
|
piece_block b = i->first;
|
||||||
int count = i->second;
|
int count = i->second;
|
||||||
int picker_count = m_picker->num_peers(b);
|
int picker_count = m_picker->num_peers(b);
|
||||||
if (!m_picker->is_downloaded(b))
|
// if we're no longer downloading the piece
|
||||||
|
// (for instance, it may be fully downloaded and waiting
|
||||||
|
// for the hash check to return), the piece picker always
|
||||||
|
// returns 0 requests, regardless of how many peers may still
|
||||||
|
// have the block in their queue
|
||||||
|
if (!m_picker->is_downloaded(b) && m_picker->is_downloading(b.piece_index))
|
||||||
TORRENT_ASSERT(picker_count == count);
|
TORRENT_ASSERT(picker_count == count);
|
||||||
}
|
}
|
||||||
TORRENT_ASSERT(num_have() >= m_picker->num_have_filtered());
|
TORRENT_ASSERT(num_have() >= m_picker->num_have_filtered());
|
||||||
|
Reference in New Issue
Block a user