diff --git a/src/torrent.cpp b/src/torrent.cpp index 1f2353587..678ab9f8b 100755 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -1888,6 +1888,10 @@ namespace libtorrent { INVARIANT_CHECK; + assert(peerinfo); + assert(peerinfo->connection == 0); + assert(m_connections.find(peerinfo->ip) == m_connections.end()); + if (!want_more_peers()) return 0; tcp::endpoint const& a(peerinfo->ip); @@ -1901,8 +1905,6 @@ namespace libtorrent return 0; } - if (m_connections.find(a) != m_connections.end()) return 0; - boost::shared_ptr s = instantiate_connection(m_ses.m_io_service, m_ses.peer_proxy()); boost::intrusive_ptr c(new bt_peer_connection( @@ -1925,8 +1927,6 @@ namespace libtorrent { m_ses.m_connection_queue.push_back(c); - assert(m_connections.find(a) == m_connections.end()); - #ifndef NDEBUG m_policy->check_invariant(); #endif