increase connection limit for local peers if limits are ignored for local network in order to accept more incoming connections from the local network

This commit is contained in:
Arvid Norberg 2010-01-31 18:35:46 +00:00
parent 6a5164b990
commit dbffe3aee9
1 changed files with 9 additions and 1 deletions

View File

@ -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()