From 2add9d193a371a7c9fef870c4102f736ad5961b2 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Sun, 24 Apr 2011 23:26:54 +0000 Subject: [PATCH] fix issue of adding duplicate incoming connections indefinitely to peer list when allow_multiple_connections_per_ip is enabled --- src/policy.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/policy.cpp b/src/policy.cpp index b66af5550..e996c3950 100644 --- a/src/policy.cpp +++ b/src/policy.cpp @@ -1367,6 +1367,17 @@ namespace libtorrent // to still exist when we get back there, to assign the new // peer connection pointer to it. The peer list must // be left intact. + + // if we allow multiple connections per IP, and this peer + // was incoming and it never advertised its listen + // port, we don't really know which peer it was. In order + // to avoid adding one entry for every single connection + // the peer makes to us, don't save this entry + if (m_torrent->settings().allow_multiple_connections_per_ip + && !p->connectable) + { + erase_peer(p); + } } void policy::peer_is_interesting(peer_connection& c)