fixed rare crash when purging the peer list
This commit is contained in:
parent
b3128685d9
commit
fb3049a0eb
|
@ -33,6 +33,7 @@
|
|||
incoming connection
|
||||
* added more detailed instrumentation of the disk I/O thread
|
||||
|
||||
* fixed rare crash when purging the peer list
|
||||
* fixed race condition around m_abort in session_impl
|
||||
* fixed bug in web_peer_connection which could cause a hang when downloading
|
||||
from web servers
|
||||
|
|
|
@ -382,6 +382,7 @@ namespace libtorrent
|
|||
}
|
||||
TORRENT_ASSERT(m_num_connect_candidates < m_peers.size());
|
||||
if (m_round_robin > i - m_peers.begin()) --m_round_robin;
|
||||
if (m_round_robin >= m_peers.size()) m_round_robin = 0;
|
||||
|
||||
#if TORRENT_USE_IPV6
|
||||
if ((*i)->is_v6_addr)
|
||||
|
@ -538,7 +539,7 @@ namespace libtorrent
|
|||
external_ip = address_v4(bytes);
|
||||
}
|
||||
|
||||
if (m_round_robin == m_peers.size()) m_round_robin = 0;
|
||||
if (m_round_robin >= m_peers.size()) m_round_robin = 0;
|
||||
|
||||
#ifndef TORRENT_DISABLE_DHT
|
||||
bool pinged = false;
|
||||
|
@ -551,7 +552,7 @@ namespace libtorrent
|
|||
for (int iterations = (std::min)(int(m_peers.size()), 300);
|
||||
iterations > 0; --iterations)
|
||||
{
|
||||
if (m_round_robin == int(m_peers.size())) m_round_robin = 0;
|
||||
if (m_round_robin >= int(m_peers.size())) m_round_robin = 0;
|
||||
|
||||
peer& pe = *m_peers[m_round_robin];
|
||||
int current = m_round_robin;
|
||||
|
@ -778,7 +779,6 @@ namespace libtorrent
|
|||
return false;
|
||||
}
|
||||
|
||||
if (m_round_robin > iter - m_peers.begin()) ++m_round_robin;
|
||||
#if TORRENT_USE_IPV6
|
||||
bool is_v6 = c.remote().address().is_v6();
|
||||
#endif
|
||||
|
@ -804,6 +804,8 @@ namespace libtorrent
|
|||
|
||||
iter = m_peers.insert(iter, p);
|
||||
|
||||
if (m_round_robin >= iter - m_peers.begin()) ++m_round_robin;
|
||||
|
||||
i = *iter;
|
||||
#ifndef TORRENT_DISABLE_GEO_IP
|
||||
int as = ses.as_for_ip(c.remote().address());
|
||||
|
@ -962,10 +964,10 @@ namespace libtorrent
|
|||
, p->address(), peer_address_compare());
|
||||
}
|
||||
|
||||
if (m_round_robin > iter - m_peers.begin()) ++m_round_robin;
|
||||
|
||||
iter = m_peers.insert(iter, p);
|
||||
|
||||
if (m_round_robin >= iter - m_peers.begin()) ++m_round_robin;
|
||||
|
||||
#ifndef TORRENT_DISABLE_ENCRYPTION
|
||||
if (flags & 0x01) p->pe_support = true;
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue