From b8726bd4f6d69eba05cb6cbf56a189f8b196a6f0 Mon Sep 17 00:00:00 2001 From: arvidn Date: Tue, 14 Jan 2020 23:52:08 +0100 Subject: [PATCH] refactor discover_device() away from upnp --- include/libtorrent/upnp.hpp | 1 - src/session_impl.cpp | 2 -- src/upnp.cpp | 13 ++----------- test/test_upnp.cpp | 1 - 4 files changed, 2 insertions(+), 15 deletions(-) diff --git a/include/libtorrent/upnp.hpp b/include/libtorrent/upnp.hpp index 55cec0f59..834017d29 100644 --- a/include/libtorrent/upnp.hpp +++ b/include/libtorrent/upnp.hpp @@ -182,7 +182,6 @@ struct TORRENT_EXTRA_EXPORT upnp final bool get_mapping(port_mapping_t mapping_index, tcp::endpoint& local_ep, int& external_port , portmap_protocol& protocol) const; - void discover_device(); void close(); // This is only available for UPnP routers. If the model is advertised by diff --git a/src/session_impl.cpp b/src/session_impl.cpp index 2d93853c7..b2f4bf900 100644 --- a/src/session_impl.cpp +++ b/src/session_impl.cpp @@ -6657,8 +6657,6 @@ namespace aux { , *this); m_upnp->start(); - m_upnp->discover_device(); - for (auto& s : m_listen_sockets) { remap_ports(remap_upnp, *s); diff --git a/src/upnp.cpp b/src/upnp.cpp index f7e950f13..ac78256f5 100644 --- a/src/upnp.cpp +++ b/src/upnp.cpp @@ -119,21 +119,12 @@ void upnp::start() , lt::get_io_service(m_refresh_timer), ec); m_mappings.reserve(10); -} - -upnp::~upnp() = default; - -void upnp::discover_device() -{ - TORRENT_ASSERT(is_single_thread()); -#ifndef TORRENT_DISABLE_LOGGING - if (m_socket.num_send_sockets() == 0) - log("No network interfaces to broadcast to"); -#endif discover_device_impl(); } +upnp::~upnp() = default; + #ifndef TORRENT_DISABLE_LOGGING bool upnp::should_log() const { diff --git a/test/test_upnp.cpp b/test/test_upnp.cpp index bdcf7b00d..ca2d7d262 100644 --- a/test/test_upnp.cpp +++ b/test/test_upnp.cpp @@ -198,7 +198,6 @@ void run_upnp_test(char const* root_filename, char const* control_name, int igd_ upnp_callback cb; auto upnp_handler = std::make_shared(ios, user_agent, cb); upnp_handler->start(); - upnp_handler->discover_device(); for (int i = 0; i < 20; ++i) {