forked from premiere/premiere-libtorrent
return a vector of mapping ids from add_port_mapping
This commit is contained in:
parent
e523566622
commit
fbaa1afd62
|
@ -646,7 +646,7 @@ namespace aux {
|
|||
void stop_natpmp();
|
||||
void stop_upnp();
|
||||
|
||||
port_mapping_t add_port_mapping(portmap_protocol t, int external_port
|
||||
std::vector<port_mapping_t> add_port_mapping(portmap_protocol t, int external_port
|
||||
, int local_port);
|
||||
void delete_port_mapping(port_mapping_t handle);
|
||||
|
||||
|
|
|
@ -1012,7 +1012,7 @@ namespace libtorrent {
|
|||
// whichever is enabled. The return value is a handle referring to the
|
||||
// port mapping that was just created. Pass it to delete_port_mapping()
|
||||
// to remove it.
|
||||
port_mapping_t add_port_mapping(portmap_protocol t, int external_port, int local_port);
|
||||
std::vector<port_mapping_t> add_port_mapping(portmap_protocol t, int external_port, int local_port);
|
||||
void delete_port_mapping(port_mapping_t handle);
|
||||
|
||||
// This option indicates if the ports are mapped using natpmp
|
||||
|
|
|
@ -1226,10 +1226,10 @@ namespace {
|
|||
}
|
||||
#endif // TORRENT_ABI_VERSION
|
||||
|
||||
port_mapping_t session_handle::add_port_mapping(portmap_protocol const t
|
||||
std::vector<port_mapping_t> session_handle::add_port_mapping(portmap_protocol const t
|
||||
, int external_port, int local_port)
|
||||
{
|
||||
return sync_call_ret<port_mapping_t>(&session_impl::add_port_mapping, t, external_port, local_port);
|
||||
return sync_call_ret<std::vector<port_mapping_t>>(&session_impl::add_port_mapping, t, external_port, local_port);
|
||||
}
|
||||
|
||||
void session_handle::delete_port_mapping(port_mapping_t handle)
|
||||
|
|
|
@ -6696,17 +6696,17 @@ namespace aux {
|
|||
return m_upnp.get();
|
||||
}
|
||||
|
||||
port_mapping_t session_impl::add_port_mapping(portmap_protocol const t
|
||||
std::vector<port_mapping_t> session_impl::add_port_mapping(portmap_protocol const t
|
||||
, int const external_port
|
||||
, int const local_port)
|
||||
{
|
||||
port_mapping_t ret{-1};
|
||||
if (m_upnp) ret = m_upnp->add_mapping(t, external_port
|
||||
, tcp::endpoint({}, static_cast<std::uint16_t>(local_port)));
|
||||
std::vector<port_mapping_t> ret;
|
||||
if (m_upnp) ret.push_back(m_upnp->add_mapping(t, external_port
|
||||
, tcp::endpoint({}, static_cast<std::uint16_t>(local_port))));
|
||||
for (auto& s : m_listen_sockets)
|
||||
{
|
||||
if (s->natpmp_mapper) ret = s->natpmp_mapper->add_mapping(t, external_port
|
||||
, tcp::endpoint({}, static_cast<std::uint16_t>(local_port)));
|
||||
if (s->natpmp_mapper) ret.push_back(s->natpmp_mapper->add_mapping(t, external_port
|
||||
, tcp::endpoint({}, static_cast<std::uint16_t>(local_port))));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue