From ac76c967ae323596bc4c776c8ff7553a9bc84818 Mon Sep 17 00:00:00 2001 From: Miguel Freitas Date: Mon, 28 Oct 2013 18:05:13 -0200 Subject: [PATCH] do not add peers with high failcount to the local dht tracker --- libtorrent/src/torrent.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/libtorrent/src/torrent.cpp b/libtorrent/src/torrent.cpp index dde7b2aa..2ef492f4 100644 --- a/libtorrent/src/torrent.cpp +++ b/libtorrent/src/torrent.cpp @@ -2057,25 +2057,25 @@ namespace libtorrent { TORRENT_ASSERT(m_ses.is_network_thread()); if (!m_ses.m_dht) return; - if (!m_name) return; + if (!m_name) return; if (!should_announce_dht()) return; TORRENT_ASSERT(m_allow_peers); - // [MF] use m_dht->announce with myself=false to update dht tracker with other peers + // [MF] use m_dht->announce with myself=false to update dht tracker with peers we know { - policy::const_iterator i = get_policy().begin_peer(); - policy::const_iterator end = get_policy().end_peer(); - for (; i != end; ++i) - { - policy::peer const* p = *i; + policy::const_iterator i = get_policy().begin_peer(); + policy::const_iterator end = get_policy().end_peer(); + for (; i != end; ++i) { + policy::peer const* p = *i; - if( p->connectable && !p->banned ) { + if( p->connectable && !p->banned && + int(p->failcount) < settings().max_failcount ) { m_ses.m_dht->announce(name(), m_torrent_file->info_hash() , p->address(), p->port, p->seed, false , boost::bind(&nop)); + } } - } } #ifdef TORRENT_USE_OPENSSL