From afc80b7e98b56c1e8a1800aa1ef5106c3ae8c3c5 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Sun, 27 Mar 2011 06:07:23 +0000 Subject: [PATCH] fix invalid assert that would trigger when allow_multiple_connections_per_ip was true --- src/torrent.cpp | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/torrent.cpp b/src/torrent.cpp index 3ba98169a..351d9889f 100644 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -4885,20 +4885,19 @@ namespace libtorrent peerinfo->last_connected = m_ses.session_time(); #ifdef TORRENT_DEBUG - // this asserts that we don't have duplicates in the policy's peer list - peer_iterator i_ = std::find_if(m_connections.begin(), m_connections.end() - , boost::bind(&peer_connection::remote, _1) == peerinfo->ip()); + if (!settings().allow_multiple_connections_per_ip) + { + // this asserts that we don't have duplicates in the policy's peer list + peer_iterator i_ = std::find_if(m_connections.begin(), m_connections.end() + , boost::bind(&peer_connection::remote, _1) == peerinfo->ip()); + TORRENT_ASSERT(i_ == m_connections.end() + || (*i_)->type() != peer_connection::bittorrent_connection #if TORRENT_USE_I2P - TORRENT_ASSERT(i_ == m_connections.end() - || (*i_)->type() != peer_connection::bittorrent_connection - || peerinfo->is_i2p_addr - ); -#else - TORRENT_ASSERT(i_ == m_connections.end() - || (*i_)->type() != peer_connection::bittorrent_connection - ); + || peerinfo->is_i2p_addr #endif + ); #endif + } TORRENT_ASSERT(want_more_peers() || ignore_limit); TORRENT_ASSERT(m_ses.num_connections() < m_ses.settings().connections_limit || ignore_limit);