fix port mapping functions in session

This commit is contained in:
Arvid Norberg 2013-12-31 22:24:56 +00:00
parent 3858025c3c
commit 53a62344ca
3 changed files with 14 additions and 9 deletions

View File

@ -485,6 +485,10 @@ namespace libtorrent
void stop_natpmp();
void stop_upnp();
int add_port_mapping(int t, int external_port
, int local_port);
void delete_port_mapping(int handle);
int next_port();
void add_redundant_bytes(size_type b, int reason)

View File

@ -1163,12 +1163,13 @@ namespace libtorrent
int session::add_port_mapping(protocol_type t, int external_port, int local_port)
{
TORRENT_SYNC_CALL_RET3(add_port_forward, int, t, external_port, local_port);
TORRENT_SYNC_CALL_RET3(int, add_port_mapping, int(t), external_port, local_port);
return r;
}
void session::delete_port_mapping(int handle)
{
TORRENT_ASYNC_CALL1(delete_port_forward, handle);
TORRENT_ASYNC_CALL1(delete_port_mapping, handle);
}
void session::stop_lsd()

View File

@ -6173,22 +6173,22 @@ retry:
return u;
}
int session_impl::add_port_mapping(protocol_type t, int external_port
int session_impl::add_port_mapping(int t, int external_port
, int local_port)
{
int ret = 0;
if (m_upnp) ret = m_upnp->add_mapping(t, external_port
, internal_port);
if (m_natpmp) ret = m_natpmp->add_mapping(t, external_port
, internal_port);
if (m_upnp) ret = m_upnp->add_mapping((upnp::protocol_type)t, external_port
, local_port);
if (m_natpmp) ret = m_natpmp->add_mapping((natpmp::protocol_type)t, external_port
, local_port);
return ret;
}
void session_impl::delete_port_mapping(int handle)
{
int ret = 0;
if (m_upnp) ret = m_upnp->delete_mapping(handle);
if (m_natpmp) ret = m_natpmp->delete_mapping(handle);
if (m_upnp) m_upnp->delete_mapping(handle);
if (m_natpmp) m_natpmp->delete_mapping(handle);
}
void session_impl::stop_lsd()