fixed possible crash when enabling multiple connections per IP
This commit is contained in:
parent
a699ab3768
commit
ecb9b2b725
|
@ -1,4 +1,5 @@
|
||||||
|
|
||||||
|
* fixed possible crash when enabling multiple connections per IP
|
||||||
* fixed typo in win vista specific code, breaking the build
|
* fixed typo in win vista specific code, breaking the build
|
||||||
* change default of rate_limit_utp to true
|
* change default of rate_limit_utp to true
|
||||||
* fixed DLL export issue on windows (when building a shared library linking statically against boost)
|
* fixed DLL export issue on windows (when building a shared library linking statically against boost)
|
||||||
|
|
|
@ -1029,6 +1029,14 @@ namespace libtorrent
|
||||||
pp.source |= src;
|
pp.source |= src;
|
||||||
if (!was_conn_cand && is_connect_candidate(pp, m_finished))
|
if (!was_conn_cand && is_connect_candidate(pp, m_finished))
|
||||||
++m_num_connect_candidates;
|
++m_num_connect_candidates;
|
||||||
|
// calling disconnect() on a peer, may actually end
|
||||||
|
// up "garbage collecting" its policy::peer entry
|
||||||
|
// as well, if it's considered useless (which this specific)
|
||||||
|
// case will, since it was an incoming peer that just disconnected
|
||||||
|
// and we allow multiple connections per IP. Because of that,
|
||||||
|
// we need to make sure we don't let it do that, by unlinking
|
||||||
|
// the peer_connection from the policy::peer first.
|
||||||
|
p->connection->set_peer_info(0);
|
||||||
p->connection->disconnect(errors::duplicate_peer_id);
|
p->connection->disconnect(errors::duplicate_peer_id);
|
||||||
erase_peer(p);
|
erase_peer(p);
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue