added asserts to make sure the global connection limit is not exceeded
This commit is contained in:
parent
4aa018484a
commit
e248ba0cdc
|
@ -976,6 +976,8 @@ namespace detail
|
||||||
// if we should not make any more connections
|
// if we should not make any more connections
|
||||||
// attempts this tick, abort
|
// attempts this tick, abort
|
||||||
if (max_connections == 0) break;
|
if (max_connections == 0) break;
|
||||||
|
// maintain the global limit on number of connections
|
||||||
|
if (num_connections() >= m_max_connections) break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1838,6 +1838,7 @@ namespace libtorrent
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
assert(want_more_peers());
|
assert(want_more_peers());
|
||||||
|
assert(m_ses.num_connections() < m_ses.max_connections());
|
||||||
|
|
||||||
tcp::endpoint const& a(peerinfo->ip);
|
tcp::endpoint const& a(peerinfo->ip);
|
||||||
assert((m_ses.m_ip_filter.access(a.address()) & ip_filter::blocked) == 0);
|
assert((m_ses.m_ip_filter.access(a.address()) & ip_filter::blocked) == 0);
|
||||||
|
|
Loading…
Reference in New Issue