fix bug which made set_max_connections not work

This commit is contained in:
Marcos Pinto 2007-10-27 21:22:54 +00:00
parent 902e8a2526
commit 3ed1de43c2
1 changed files with 11 additions and 0 deletions

View File

@ -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;