diff --git a/src/session_impl.cpp b/src/session_impl.cpp index 4d45092cd..125664302 100755 --- a/src/session_impl.cpp +++ b/src/session_impl.cpp @@ -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; } } diff --git a/src/torrent.cpp b/src/torrent.cpp index 3091eba35..9cd2c277c 100755 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -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);