From 3ed1de43c22dc4b9d616ef2beb6787bafe640529 Mon Sep 17 00:00:00 2001 From: Marcos Pinto Date: Sat, 27 Oct 2007 21:22:54 +0000 Subject: [PATCH] fix bug which made set_max_connections not work --- libtorrent/src/session_impl.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/libtorrent/src/session_impl.cpp b/libtorrent/src/session_impl.cpp index 68b252663..12b95562b 100755 --- a/libtorrent/src/session_impl.cpp +++ b/libtorrent/src/session_impl.cpp @@ -993,6 +993,17 @@ namespace detail return; } + // don't allow more connections than the max setting + if (m_connections.size() > max_connections()) + { +#if defined(TORRENT_VERBOSE_LOGGING) || defined(TORRENT_LOGGING) + (*m_logger) << "number of connections limit exceeded (conns: " + << num_connections() << ", limit: " << max_connections() + << "), connection rejected\n"; +#endif + return; + } + // check if we have any active torrents // if we don't reject the connection if (m_torrents.empty()) return;