From 7de186fcc6d390f2c7c1d60189d3f82022f32336 Mon Sep 17 00:00:00 2001 From: arvidn Date: Sat, 25 Jan 2025 15:34:23 +0100 Subject: [PATCH] fix applying IP filter to DHT traffic (HanabishiRecca) --- ChangeLog | 1 + src/torrent.cpp | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index a22974aaac..1d867fbe16 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,7 @@ 2.0.11 released + * fix applying IP filter to DHT traffic (HanabishiRecca) * fix race condition when cancelling requests after becoming a seed * fix performance bug in the file pool, evicting MRU instead of LRU (HanabishiRecca) * fix bug where file_progress could sometimes be reported as >100% diff --git a/src/torrent.cpp b/src/torrent.cpp index 90a5408b3b..7f731e1239 100644 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -11182,17 +11182,6 @@ namespace { TORRENT_ASSERT(info_hash().has_v2() || !(flags & pex_lt_v2)); -#ifndef TORRENT_DISABLE_DHT - if (source != peer_info::resume_data) - { - // try to send a DHT ping to this peer - // as well, to figure out if it supports - // DHT (uTorrent and BitComet don't - // advertise support) - session().add_dht_node({adr.address(), adr.port()}); - } -#endif - if (m_apply_ip_filter && m_ip_filter && m_ip_filter->access(adr.address()) & ip_filter::blocked) @@ -11241,6 +11230,17 @@ namespace { return nullptr; } +#ifndef TORRENT_DISABLE_DHT + if (source != peer_info::resume_data) + { + // try to send a DHT ping to this peer + // as well, to figure out if it supports + // DHT (uTorrent and BitComet don't + // advertise support) + session().add_dht_node({adr.address(), adr.port()}); + } +#endif + if (!torrent_file().info_hashes().has_v1()) flags |= pex_lt_v2;