From bc656acebbad3394d36de1854d5646717f0a9543 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Thu, 27 Dec 2007 10:19:36 +0000 Subject: [PATCH] fix limiting incoming connections to torrent limit --- src/torrent.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/torrent.cpp b/src/torrent.cpp index 83137f31d..1d2928c07 100755 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -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