added asserts to make sure the global connection limit is not exceeded

This commit is contained in:
Arvid Norberg 2007-08-27 16:45:45 +00:00
parent 4aa018484a
commit e248ba0cdc
2 changed files with 3 additions and 0 deletions

View File

@ -976,6 +976,8 @@ namespace detail
// if we should not make any more connections
// attempts this tick, abort
if (max_connections == 0) break;
// maintain the global limit on number of connections
if (num_connections() >= m_max_connections) break;
}
}

View File

@ -1838,6 +1838,7 @@ namespace libtorrent
#endif
assert(want_more_peers());
assert(m_ses.num_connections() < m_ses.max_connections());
tcp::endpoint const& a(peerinfo->ip);
assert((m_ses.m_ip_filter.access(a.address()) & ip_filter::blocked) == 0);