cancels more async operations on shutdown

This commit is contained in:
Arvid Norberg 2007-11-11 19:09:29 +00:00
parent 41ef204f26
commit 95d09070fb
3 changed files with 7 additions and 0 deletions

View File

@ -128,6 +128,7 @@ public:
void close(asio::error_code& ec)
{
m_sock.close(ec);
m_resolver.cancel();
}
endpoint_type remote_endpoint()

View File

@ -224,6 +224,7 @@ namespace libtorrent { namespace dht
m_connection_timer.cancel();
m_refresh_timer.cancel();
m_socket.close();
m_host_resolver.cancel();
}
void dht_tracker::dht_status(session_status& s)

View File

@ -278,6 +278,7 @@ namespace libtorrent
{
boost::weak_ptr<torrent> self(shared_from_this());
if (m_torrent_file->is_valid()) init();
if (m_abort) return;
m_announce_timer.expires_from_now(seconds(1));
m_announce_timer.async_wait(m_ses.m_strand.wrap(
bind(&torrent::on_announce_disp, self, _1)));
@ -421,6 +422,8 @@ namespace libtorrent
try
#endif
{
if (m_abort) return;
boost::weak_ptr<torrent> self(shared_from_this());
if (!m_torrent_file->priv())
@ -1060,6 +1063,7 @@ namespace libtorrent
m_owning_storage = 0;
m_announce_timer.cancel();
m_host_resolver.cancel();
}
void torrent::on_files_deleted(int ret, disk_io_job const& j)
@ -2206,6 +2210,7 @@ namespace libtorrent
// only start the announce if we want to announce with the dht
if (should_announce_dht())
{
if (m_abort) return;
// force the DHT to reannounce
m_last_dht_announce = time_now() - minutes(15);
boost::weak_ptr<torrent> self(shared_from_this());