From dbffe3aee9ffc1a03dcd3d3f72d8d2ce9f442a20 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Sun, 31 Jan 2010 18:35:46 +0000 Subject: [PATCH] increase connection limit for local peers if limits are ignored for local network in order to accept more incoming connections from the local network --- src/session_impl.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/session_impl.cpp b/src/session_impl.cpp index f9c348e80..7ada3daf8 100644 --- a/src/session_impl.cpp +++ b/src/session_impl.cpp @@ -1428,8 +1428,16 @@ namespace aux { } // don't allow more connections than the max setting - if (num_connections() >= max_connections()) + bool reject = false; + if (m_settings.ignore_limits_on_local_network && is_local(endp.address())) + reject = max_connections() < INT_MAX / 12 + && num_connections() >= max_connections() * 12 / 10; + else + reject = num_connections() >= max_connections(); + + if (reject) { + // TODO: post alert #if defined(TORRENT_VERBOSE_LOGGING) || defined(TORRENT_LOGGING) (*m_logger) << "number of connections limit exceeded (conns: " << num_connections() << ", limit: " << max_connections()