From a57ad00e15fcf5332744ad0024e3a5749b0b4078 Mon Sep 17 00:00:00 2001 From: arvidn Date: Tue, 21 Nov 2017 02:06:43 +0100 Subject: [PATCH] fix force-proxy regression (udp sockets would not be opened) --- simulation/test_session.cpp | 2 +- src/session_impl.cpp | 11 +++-------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/simulation/test_session.cpp b/simulation/test_session.cpp index df5f36f80..df6cfe8bf 100644 --- a/simulation/test_session.cpp +++ b/simulation/test_session.cpp @@ -111,6 +111,6 @@ TORRENT_TEST(force_proxy) sim.run(); TEST_EQUAL(num_listen_tcp, 1); - TEST_EQUAL(num_listen_udp, 1); + TEST_EQUAL(num_listen_udp, 2); } diff --git a/src/session_impl.cpp b/src/session_impl.cpp index 9534fa7ab..3f91931e6 100644 --- a/src/session_impl.cpp +++ b/src/session_impl.cpp @@ -1885,12 +1885,6 @@ retry: m_stats_counters.set_value(counters::has_incoming_connections, 0); ec.clear(); - if (m_settings.get_bool(settings_pack::force_proxy)) - { - // in force-proxy mode, we don't open any listen sockets - return; - } - if (m_abort) return; m_ipv6_interface = tcp::endpoint(); @@ -1899,7 +1893,8 @@ retry: // TODO: instead of having a special case for this, just make the // default listen interfaces be "0.0.0.0:6881,[::]:6881" and use // the generic path. That would even allow for not listening at all. - if (m_listen_interfaces.empty()) + if (m_listen_interfaces.empty() + && !m_settings.get_bool(settings_pack::force_proxy)) { // this means we should open two listen sockets // one for IPv4 and one for IPv6 @@ -1978,7 +1973,7 @@ retry: m_ipv4_interface = tcp::endpoint(addr, m_listen_interface.port()); } } - else + else if (!m_settings.get_bool(settings_pack::force_proxy)) { // TODO: 2 the udp socket(s) should be using the same generic // mechanism and not be restricted to a single one