From 697fa4911b92b26b9adcdbf4a7679593f4851297 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Fri, 30 Mar 2012 04:29:54 +0000 Subject: [PATCH] add asserts for peers to be destructed in the network thread --- src/bt_peer_connection.cpp | 1 + src/peer_connection.cpp | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/bt_peer_connection.cpp b/src/bt_peer_connection.cpp index d9296fe53..d1accacec 100644 --- a/src/bt_peer_connection.cpp +++ b/src/bt_peer_connection.cpp @@ -197,6 +197,7 @@ namespace libtorrent bt_peer_connection::~bt_peer_connection() { + TORRENT_ASSERT(m_ses.is_network_thread()); } void bt_peer_connection::on_connected() diff --git a/src/peer_connection.cpp b/src/peer_connection.cpp index 92bfb1bb3..a0597f702 100644 --- a/src/peer_connection.cpp +++ b/src/peer_connection.cpp @@ -918,6 +918,7 @@ namespace libtorrent TORRENT_ASSERT(!m_in_constructor); TORRENT_ASSERT(m_disconnecting); TORRENT_ASSERT(m_disconnect_started); + TORRENT_ASSERT(m_ses.is_network_thread()); #if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS m_in_use = 0; @@ -950,7 +951,7 @@ namespace libtorrent // TORRENT_ASSERT(!m_ses.has_peer(this)); TORRENT_ASSERT(m_request_queue.empty()); TORRENT_ASSERT(m_download_queue.empty()); -#ifdef TORRENT_DEBUG +#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS for (aux::session_impl::torrent_map::const_iterator i = m_ses.m_torrents.begin() , end(m_ses.m_torrents.end()); i != end; ++i) TORRENT_ASSERT(!i->second->has_peer(this));