From 43d5781638c014c3a0b8e720497eb928f010d4b3 Mon Sep 17 00:00:00 2001 From: Arvid Norberg <arvid@libtorrent.org> Date: Sun, 13 Apr 2008 19:19:22 +0000 Subject: [PATCH] port mapping fix --- src/session_impl.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/session_impl.cpp b/src/session_impl.cpp index f3f95b7c0..edb5a4f03 100755 --- a/src/session_impl.cpp +++ b/src/session_impl.cpp @@ -2145,8 +2145,11 @@ namespace aux { , bind(&session_impl::on_port_mapping , this, _1, _2, _3, 0)); - m_tcp_mapping[0] = m_natpmp->add_mapping(natpmp::tcp - , m_listen_interface.port(), m_listen_interface.port()); + if (m_listen_interface.port() > 0) + { + m_tcp_mapping[0] = m_natpmp->add_mapping(natpmp::tcp + , m_listen_interface.port(), m_listen_interface.port()); + } #ifndef TORRENT_DISABLE_DHT if (m_dht) m_udp_mapping[0] = m_natpmp->add_mapping(natpmp::udp @@ -2172,8 +2175,11 @@ namespace aux { , m_settings.upnp_ignore_nonrouters); m_upnp->discover_device(); - m_tcp_mapping[1] = m_upnp->add_mapping(upnp::tcp - , m_listen_interface.port(), m_listen_interface.port()); + if (m_listen_interface.port() > 0) + { + m_tcp_mapping[1] = m_upnp->add_mapping(upnp::tcp + , m_listen_interface.port(), m_listen_interface.port()); + } #ifndef TORRENT_DISABLE_DHT if (m_dht) m_udp_mapping[1] = m_upnp->add_mapping(upnp::udp