fix limiting incoming connections to torrent limit

This commit is contained in:
Arvid Norberg 2007-12-27 10:19:36 +00:00
parent e1b1123c48
commit bc656acebb
1 changed files with 5 additions and 0 deletions

View File

@ -2177,6 +2177,11 @@ namespace libtorrent
throw protocol_error("session is closing");
}
if (int(m_connections.size()) >= m_max_connections)
{
throw protocol_error("reached connection limit");
}
TORRENT_ASSERT(m_connections.find(p) == m_connections.end());
peer_iterator ci = m_connections.insert(p).first;
try