fix invalid assert that would trigger when allow_multiple_connections_per_ip was true

This commit is contained in:
Arvid Norberg 2011-03-27 06:07:23 +00:00
parent 2ebe46024b
commit afc80b7e98
1 changed files with 10 additions and 11 deletions

View File

@ -4885,20 +4885,19 @@ namespace libtorrent
peerinfo->last_connected = m_ses.session_time(); peerinfo->last_connected = m_ses.session_time();
#ifdef TORRENT_DEBUG #ifdef TORRENT_DEBUG
if (!settings().allow_multiple_connections_per_ip)
{
// this asserts that we don't have duplicates in the policy's peer list // 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() peer_iterator i_ = std::find_if(m_connections.begin(), m_connections.end()
, boost::bind(&peer_connection::remote, _1) == peerinfo->ip()); , boost::bind(&peer_connection::remote, _1) == peerinfo->ip());
TORRENT_ASSERT(i_ == m_connections.end()
|| (*i_)->type() != peer_connection::bittorrent_connection
#if TORRENT_USE_I2P #if TORRENT_USE_I2P
TORRENT_ASSERT(i_ == m_connections.end()
|| (*i_)->type() != peer_connection::bittorrent_connection
|| peerinfo->is_i2p_addr || peerinfo->is_i2p_addr
); #endif
#else
TORRENT_ASSERT(i_ == m_connections.end()
|| (*i_)->type() != peer_connection::bittorrent_connection
); );
#endif #endif
#endif }
TORRENT_ASSERT(want_more_peers() || ignore_limit); TORRENT_ASSERT(want_more_peers() || ignore_limit);
TORRENT_ASSERT(m_ses.num_connections() < m_ses.settings().connections_limit || ignore_limit); TORRENT_ASSERT(m_ses.num_connections() < m_ses.settings().connections_limit || ignore_limit);