fixed rare bug where we might erase an entry from the policy peer list when we shouldn't
This commit is contained in:
parent
b80664bbaa
commit
5247db7f90
|
@ -731,6 +731,7 @@ namespace libtorrent
|
||||||
{
|
{
|
||||||
c.disconnect(errors::self_connection, 1);
|
c.disconnect(errors::self_connection, 1);
|
||||||
i->connection->disconnect(errors::self_connection, 1);
|
i->connection->disconnect(errors::self_connection, 1);
|
||||||
|
TORRENT_ASSERT(i->connection == 0);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -740,6 +741,7 @@ namespace libtorrent
|
||||||
if (ec2)
|
if (ec2)
|
||||||
{
|
{
|
||||||
i->connection->disconnect(ec2);
|
i->connection->disconnect(ec2);
|
||||||
|
TORRENT_ASSERT(i->connection == 0);
|
||||||
}
|
}
|
||||||
else if (!i->connection->is_connecting() || c.is_local())
|
else if (!i->connection->is_connecting() || c.is_local())
|
||||||
{
|
{
|
||||||
|
@ -754,6 +756,7 @@ namespace libtorrent
|
||||||
"connection in favour of this one");
|
"connection in favour of this one");
|
||||||
#endif
|
#endif
|
||||||
i->connection->disconnect(errors::duplicate_peer_id);
|
i->connection->disconnect(errors::duplicate_peer_id);
|
||||||
|
TORRENT_ASSERT(i->connection == 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -835,6 +838,7 @@ namespace libtorrent
|
||||||
|
|
||||||
// this cannot be a connect candidate anymore, since i->connection is set
|
// this cannot be a connect candidate anymore, since i->connection is set
|
||||||
TORRENT_ASSERT(!is_connect_candidate(*i, m_finished));
|
TORRENT_ASSERT(!is_connect_candidate(*i, m_finished));
|
||||||
|
TORRENT_ASSERT(has_connection(&c));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1263,11 +1267,13 @@ namespace libtorrent
|
||||||
// if we're not a seed, but we have too many peers
|
// if we're not a seed, but we have too many peers
|
||||||
// start weeding the ones we only know from resume
|
// start weeding the ones we only know from resume
|
||||||
// data first
|
// data first
|
||||||
if (m_torrent->is_seed() || m_peers.size() >= m_torrent->settings().max_peerlist_size * 0.9)
|
// at this point it may be tempting to erase peers
|
||||||
{
|
// from the peer list, but keep in mind that we might
|
||||||
if (p->source == peer_info::resume_data)
|
// have gotten to this point through new_connection, just
|
||||||
erase_peer(p);
|
// disconnecting an old peer, relying on this policy::peer
|
||||||
}
|
// to still exist when we get back there, to assign the new
|
||||||
|
// peer connection pointer to it. The peer list must
|
||||||
|
// be left intact.
|
||||||
}
|
}
|
||||||
|
|
||||||
void policy::peer_is_interesting(peer_connection& c)
|
void policy::peer_is_interesting(peer_connection& c)
|
||||||
|
|
Loading…
Reference in New Issue