mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-10-17 05:29:28 +00:00
NetPlayServer: handle port forwarding in constructor
This commit is contained in:
parent
4b50e77a26
commit
b5d070b0cf
5 changed files with 11 additions and 31 deletions
|
@ -63,7 +63,8 @@ NetPlayServer::~NetPlayServer()
|
|||
}
|
||||
|
||||
// called from ---GUI--- thread
|
||||
NetPlayServer::NetPlayServer(const u16 port, const NetTraversalConfig& traversal_config)
|
||||
NetPlayServer::NetPlayServer(const u16 port, const bool forward_port,
|
||||
const NetTraversalConfig& traversal_config)
|
||||
{
|
||||
//--use server time
|
||||
if (enet_initialize() != 0)
|
||||
|
@ -103,6 +104,11 @@ NetPlayServer::NetPlayServer(const u16 port, const NetTraversalConfig& traversal
|
|||
m_do_loop = true;
|
||||
m_thread = std::thread(&NetPlayServer::ThreadFunc, this);
|
||||
m_target_buffer_size = 5;
|
||||
|
||||
#ifdef USE_UPNP
|
||||
if (forward_port)
|
||||
UPnP::TryPortmapping(port);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -931,11 +937,3 @@ std::vector<std::pair<std::string, std::string>> NetPlayServer::GetInterfaceList
|
|||
result.emplace_back(std::make_pair("!local!", "127.0.0.1"));
|
||||
return result;
|
||||
}
|
||||
|
||||
#ifdef USE_UPNP
|
||||
// called from ---GUI--- thread
|
||||
void NetPlayServer::TryPortmapping(u16 port)
|
||||
{
|
||||
UPnP::TryPortmapping(port);
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue