fixed crash in on_disk_queue and in on_receive_udp

This commit is contained in:
Arvid Norberg 2010-06-26 17:09:37 +00:00
parent d3970f62a3
commit 19c9237ffc
1 changed files with 9 additions and 5 deletions

View File

@ -1599,7 +1599,7 @@ namespace aux {
|| e == asio::error::connection_reset
|| e == asio::error::connection_aborted)
{
m_dht->on_unreachable(ep);
if (m_dht) m_dht->on_unreachable(ep);
if (m_tracker_manager.incoming_udp(e, ep, buf, len))
m_stat.received_tracker_bytes(len + 28);
}
@ -1920,13 +1920,17 @@ namespace aux {
{
mutex::scoped_lock l(m_mutex);
for (connection_map::iterator i = m_connections.begin()
, end(m_connections.end()); i != end; ++i)
for (connection_map::iterator i = m_connections.begin();
i != m_connections.end();)
{
if ((*i)->m_channel_state[peer_connection::download_channel]
peer_connection* p = *i;
++i;
if (p->m_channel_state[peer_connection::download_channel]
!= peer_info::bw_disk) continue;
(*i)->setup_receive();
// setup_receive() may disconnect the connection
// and clear it out from the m_connections list
p->setup_receive();
}
}