diff --git a/include/libtorrent/upnp.hpp b/include/libtorrent/upnp.hpp index 69389ad43..1c24455f5 100644 --- a/include/libtorrent/upnp.hpp +++ b/include/libtorrent/upnp.hpp @@ -75,6 +75,7 @@ public: // it will not be mapped void set_mappings(int tcp, int udp); + void discover_device(); void close(); std::string router_model() { return m_model; } @@ -91,7 +92,6 @@ private: void resend_request(asio::error_code const& e); void on_reply(udp::endpoint const& from, char* buffer , std::size_t bytes_transferred); - void discover_device(); struct rootdevice; diff --git a/src/session_impl.cpp b/src/session_impl.cpp index 56ffbfe08..3fa143e67 100755 --- a/src/session_impl.cpp +++ b/src/session_impl.cpp @@ -2349,6 +2349,7 @@ namespace detail , bind(&session_impl::on_port_mapping , this, _1, _2, _3)); + m_upnp->discover_device(); m_upnp->set_mappings(m_listen_interface.port(), #ifndef TORRENT_DISABLE_DHT m_dht ? m_dht_settings.service_port : diff --git a/src/upnp.cpp b/src/upnp.cpp index 5075edb06..01815b99b 100644 --- a/src/upnp.cpp +++ b/src/upnp.cpp @@ -81,7 +81,6 @@ upnp::upnp(io_service& ios, connection_queue& cc m_log.open("upnp.log", std::ios::in | std::ios::out | std::ios::trunc); #endif m_retry_count = 0; - discover_device(); } upnp::~upnp()