This commit is contained in:
Arvid Norberg 2007-08-27 06:47:08 +00:00
parent bce55bc149
commit a567f18962
1 changed files with 7 additions and 1 deletions

View File

@ -237,6 +237,7 @@ namespace libtorrent { namespace dht
try try
{ {
if (e) return; if (e) return;
if (!m_socket.is_open()) return;
time_duration d = m_dht.connection_timeout(); time_duration d = m_dht.connection_timeout();
m_connection_timer.expires_from_now(d); m_connection_timer.expires_from_now(d);
m_connection_timer.async_wait(m_strand.wrap(bind(&dht_tracker::connection_timeout, self(), _1))); m_connection_timer.async_wait(m_strand.wrap(bind(&dht_tracker::connection_timeout, self(), _1)));
@ -254,6 +255,7 @@ namespace libtorrent { namespace dht
try try
{ {
if (e) return; if (e) return;
if (!m_socket.is_open()) return;
time_duration d = m_dht.refresh_timeout(); time_duration d = m_dht.refresh_timeout();
m_refresh_timer.expires_from_now(d); m_refresh_timer.expires_from_now(d);
m_refresh_timer.async_wait(m_strand.wrap( m_refresh_timer.async_wait(m_strand.wrap(
@ -276,8 +278,9 @@ namespace libtorrent { namespace dht
try try
{ {
if (e) return; if (e) return;
if (!m_socket.is_open()) return;
m_timer.expires_from_now(minutes(tick_period)); m_timer.expires_from_now(minutes(tick_period));
m_timer.async_wait(m_strand.wrap(bind(&dht_tracker::tick, this, _1))); m_timer.async_wait(m_strand.wrap(bind(&dht_tracker::tick, self(), _1)));
ptime now = time_now(); ptime now = time_now();
if (now - m_last_new_key > minutes(key_refresh)) if (now - m_last_new_key > minutes(key_refresh))
@ -388,6 +391,7 @@ namespace libtorrent { namespace dht
try try
{ {
if (error == asio::error::operation_aborted) return; if (error == asio::error::operation_aborted) return;
if (!m_socket.is_open()) return;
int current_buffer = m_buffer; int current_buffer = m_buffer;
m_buffer = (m_buffer + 1) & 1; m_buffer = (m_buffer + 1) & 1;
@ -716,6 +720,7 @@ namespace libtorrent { namespace dht
, udp::resolver::iterator host) try , udp::resolver::iterator host) try
{ {
if (e || host == udp::resolver::iterator()) return; if (e || host == udp::resolver::iterator()) return;
if (!m_socket.is_open()) return;
add_node(host->endpoint()); add_node(host->endpoint());
} }
catch (std::exception&) catch (std::exception&)
@ -734,6 +739,7 @@ namespace libtorrent { namespace dht
, udp::resolver::iterator host) try , udp::resolver::iterator host) try
{ {
if (e || host == udp::resolver::iterator()) return; if (e || host == udp::resolver::iterator()) return;
if (!m_socket.is_open()) return;
m_dht.add_router_node(host->endpoint()); m_dht.add_router_node(host->endpoint());
} }
catch (std::exception&) catch (std::exception&)