|
|
@ -85,6 +85,8 @@ POSSIBILITY OF SUCH DAMAGE. |
|
|
|
#include "libtorrent/random.hpp" |
|
|
|
#include "libtorrent/random.hpp" |
|
|
|
#include "libtorrent/magnet_uri.hpp" |
|
|
|
#include "libtorrent/magnet_uri.hpp" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "twister.h" // for LIBTORRENT_PORT_OFFSET |
|
|
|
|
|
|
|
|
|
|
|
#if defined TORRENT_STATS && defined __MACH__ |
|
|
|
#if defined TORRENT_STATS && defined __MACH__ |
|
|
|
#include <mach/task.h> |
|
|
|
#include <mach/task.h> |
|
|
|
#endif |
|
|
|
#endif |
|
|
@ -766,6 +768,8 @@ namespace aux { |
|
|
|
|
|
|
|
|
|
|
|
m_tcp_mapping[0] = -1; |
|
|
|
m_tcp_mapping[0] = -1; |
|
|
|
m_tcp_mapping[1] = -1; |
|
|
|
m_tcp_mapping[1] = -1; |
|
|
|
|
|
|
|
m_twister_tcp_mapping[0] = -1; |
|
|
|
|
|
|
|
m_twister_tcp_mapping[1] = -1; |
|
|
|
m_udp_mapping[0] = -1; |
|
|
|
m_udp_mapping[0] = -1; |
|
|
|
m_udp_mapping[1] = -1; |
|
|
|
m_udp_mapping[1] = -1; |
|
|
|
#ifdef TORRENT_USE_OPENSSL |
|
|
|
#ifdef TORRENT_USE_OPENSSL |
|
|
@ -2463,6 +2467,9 @@ retry: |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (m_tcp_mapping[0] != -1) m_natpmp->delete_mapping(m_tcp_mapping[0]); |
|
|
|
if (m_tcp_mapping[0] != -1) m_natpmp->delete_mapping(m_tcp_mapping[0]); |
|
|
|
m_tcp_mapping[0] = m_natpmp->add_mapping(natpmp::tcp, tcp_port, tcp_port); |
|
|
|
m_tcp_mapping[0] = m_natpmp->add_mapping(natpmp::tcp, tcp_port, tcp_port); |
|
|
|
|
|
|
|
if (m_twister_tcp_mapping[0] != -1) m_natpmp->delete_mapping(m_twister_tcp_mapping[0]); |
|
|
|
|
|
|
|
m_twister_tcp_mapping[0] = m_natpmp->add_mapping(natpmp::tcp, |
|
|
|
|
|
|
|
tcp_port-LIBTORRENT_PORT_OFFSET, tcp_port-LIBTORRENT_PORT_OFFSET); |
|
|
|
#ifdef TORRENT_USE_OPENSSL |
|
|
|
#ifdef TORRENT_USE_OPENSSL |
|
|
|
if (m_ssl_mapping[0] != -1) m_natpmp->delete_mapping(m_ssl_mapping[0]); |
|
|
|
if (m_ssl_mapping[0] != -1) m_natpmp->delete_mapping(m_ssl_mapping[0]); |
|
|
|
m_ssl_mapping[0] = m_natpmp->add_mapping(natpmp::tcp, ssl_port, ssl_port); |
|
|
|
m_ssl_mapping[0] = m_natpmp->add_mapping(natpmp::tcp, ssl_port, ssl_port); |
|
|
@ -2472,6 +2479,9 @@ retry: |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (m_tcp_mapping[1] != -1) m_upnp->delete_mapping(m_tcp_mapping[1]); |
|
|
|
if (m_tcp_mapping[1] != -1) m_upnp->delete_mapping(m_tcp_mapping[1]); |
|
|
|
m_tcp_mapping[1] = m_upnp->add_mapping(upnp::tcp, tcp_port, tcp_port); |
|
|
|
m_tcp_mapping[1] = m_upnp->add_mapping(upnp::tcp, tcp_port, tcp_port); |
|
|
|
|
|
|
|
if (m_twister_tcp_mapping[1] != -1) m_upnp->delete_mapping(m_twister_tcp_mapping[1]); |
|
|
|
|
|
|
|
m_twister_tcp_mapping[1] = m_upnp->add_mapping(upnp::tcp, |
|
|
|
|
|
|
|
tcp_port-LIBTORRENT_PORT_OFFSET, tcp_port-LIBTORRENT_PORT_OFFSET); |
|
|
|
#ifdef TORRENT_USE_OPENSSL |
|
|
|
#ifdef TORRENT_USE_OPENSSL |
|
|
|
if (m_ssl_mapping[1] != -1) m_upnp->delete_mapping(m_ssl_mapping[1]); |
|
|
|
if (m_ssl_mapping[1] != -1) m_upnp->delete_mapping(m_ssl_mapping[1]); |
|
|
|
m_ssl_mapping[1] = m_upnp->add_mapping(upnp::tcp, ssl_port, ssl_port); |
|
|
|
m_ssl_mapping[1] = m_upnp->add_mapping(upnp::tcp, ssl_port, ssl_port); |
|
|
@ -6249,6 +6259,7 @@ retry: |
|
|
|
m_upnp->close(); |
|
|
|
m_upnp->close(); |
|
|
|
m_udp_mapping[1] = -1; |
|
|
|
m_udp_mapping[1] = -1; |
|
|
|
m_tcp_mapping[1] = -1; |
|
|
|
m_tcp_mapping[1] = -1; |
|
|
|
|
|
|
|
m_twister_tcp_mapping[1] = -1; |
|
|
|
#ifdef TORRENT_USE_OPENSSL |
|
|
|
#ifdef TORRENT_USE_OPENSSL |
|
|
|
m_ssl_mapping[1] = -1; |
|
|
|
m_ssl_mapping[1] = -1; |
|
|
|
#endif |
|
|
|
#endif |
|
|
|