refactor discover_device() away from upnp
This commit is contained in:
parent
a40ae61f15
commit
b8726bd4f6
|
@ -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
|
bool get_mapping(port_mapping_t mapping_index, tcp::endpoint& local_ep, int& external_port
|
||||||
, portmap_protocol& protocol) const;
|
, portmap_protocol& protocol) const;
|
||||||
|
|
||||||
void discover_device();
|
|
||||||
void close();
|
void close();
|
||||||
|
|
||||||
// This is only available for UPnP routers. If the model is advertised by
|
// This is only available for UPnP routers. If the model is advertised by
|
||||||
|
|
|
@ -6657,8 +6657,6 @@ namespace aux {
|
||||||
, *this);
|
, *this);
|
||||||
m_upnp->start();
|
m_upnp->start();
|
||||||
|
|
||||||
m_upnp->discover_device();
|
|
||||||
|
|
||||||
for (auto& s : m_listen_sockets)
|
for (auto& s : m_listen_sockets)
|
||||||
{
|
{
|
||||||
remap_ports(remap_upnp, *s);
|
remap_ports(remap_upnp, *s);
|
||||||
|
|
13
src/upnp.cpp
13
src/upnp.cpp
|
@ -119,21 +119,12 @@ void upnp::start()
|
||||||
, lt::get_io_service(m_refresh_timer), ec);
|
, lt::get_io_service(m_refresh_timer), ec);
|
||||||
|
|
||||||
m_mappings.reserve(10);
|
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();
|
discover_device_impl();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
upnp::~upnp() = default;
|
||||||
|
|
||||||
#ifndef TORRENT_DISABLE_LOGGING
|
#ifndef TORRENT_DISABLE_LOGGING
|
||||||
bool upnp::should_log() const
|
bool upnp::should_log() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -198,7 +198,6 @@ void run_upnp_test(char const* root_filename, char const* control_name, int igd_
|
||||||
upnp_callback cb;
|
upnp_callback cb;
|
||||||
auto upnp_handler = std::make_shared<upnp>(ios, user_agent, cb);
|
auto upnp_handler = std::make_shared<upnp>(ios, user_agent, cb);
|
||||||
upnp_handler->start();
|
upnp_handler->start();
|
||||||
upnp_handler->discover_device();
|
|
||||||
|
|
||||||
for (int i = 0; i < 20; ++i)
|
for (int i = 0; i < 20; ++i)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue