add asserts for peers to be destructed in the network thread

This commit is contained in:
Arvid Norberg 2012-03-30 04:29:54 +00:00
parent 418c1e8190
commit 697fa4911b
2 changed files with 3 additions and 1 deletions

View File

@ -197,6 +197,7 @@ namespace libtorrent
bt_peer_connection::~bt_peer_connection() bt_peer_connection::~bt_peer_connection()
{ {
TORRENT_ASSERT(m_ses.is_network_thread());
} }
void bt_peer_connection::on_connected() void bt_peer_connection::on_connected()

View File

@ -918,6 +918,7 @@ namespace libtorrent
TORRENT_ASSERT(!m_in_constructor); TORRENT_ASSERT(!m_in_constructor);
TORRENT_ASSERT(m_disconnecting); TORRENT_ASSERT(m_disconnecting);
TORRENT_ASSERT(m_disconnect_started); TORRENT_ASSERT(m_disconnect_started);
TORRENT_ASSERT(m_ses.is_network_thread());
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS #if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
m_in_use = 0; m_in_use = 0;
@ -950,7 +951,7 @@ namespace libtorrent
// TORRENT_ASSERT(!m_ses.has_peer(this)); // TORRENT_ASSERT(!m_ses.has_peer(this));
TORRENT_ASSERT(m_request_queue.empty()); TORRENT_ASSERT(m_request_queue.empty());
TORRENT_ASSERT(m_download_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() for (aux::session_impl::torrent_map::const_iterator i = m_ses.m_torrents.begin()
, end(m_ses.m_torrents.end()); i != end; ++i) , end(m_ses.m_torrents.end()); i != end; ++i)
TORRENT_ASSERT(!i->second->has_peer(this)); TORRENT_ASSERT(!i->second->has_peer(this));