attempt to fix an assert for a newly connected peer that disconnects just as we receive the metadata. disconnecting peers don't have their bitfield properly initialized, so we can't use it

This commit is contained in:
arvidn 2018-11-27 01:45:25 +01:00 committed by Arvid Norberg
parent 3c29f6750a
commit 88c733ef2d
2 changed files with 2 additions and 1 deletions

View File

@ -1867,7 +1867,7 @@ namespace libtorrent {
if (!t->valid_metadata() && index >= m_have_piece.end_index())
{
// TODO: 3 replace this magic number with something that makes sense
if (index < piece_index_t(131072))
if (index < piece_index_t(524288))
{
// if we don't have metadata
// and we might not have received a bitfield

View File

@ -1259,6 +1259,7 @@ bool is_downloading_state(int const st)
for (auto const p : m_connections)
{
TORRENT_INCREMENT(m_iterating_connections);
if (p->is_disconnecting()) continue;
peer_has(p->get_bitfield(), p);
}
}