mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-06-16 05:13:58 -07:00
Create port forwarding for correct port with UPnP
Up to know the UPnP logic ignored the port a user was hosting a game on
and always added a port forwarding for the default port UDP 20595. This
commit fixes that, so a port forwarding is added for the actual port a
game is hosted on.
(cherry picked from commit fcd3fc2aa3)
Signed-off-by: Itms <itms@wildfiregames.com>
This commit is contained in:
parent
a7694ef8b3
commit
83c8ec1b4a
2 changed files with 4 additions and 4 deletions
|
|
@ -193,20 +193,20 @@ bool CNetServerWorker::SetupConnection(const u16 port)
|
|||
|
||||
#if CONFIG2_MINIUPNPC
|
||||
// Launch the UPnP thread
|
||||
m_UPnPThread = std::thread(Threading::HandleExceptions<SetupUPnP>::Wrapper);
|
||||
m_UPnPThread = std::thread(Threading::HandleExceptions<SetupUPnP>::Wrapper, port);
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#if CONFIG2_MINIUPNPC
|
||||
void CNetServerWorker::SetupUPnP()
|
||||
void CNetServerWorker::SetupUPnP(const u16 port)
|
||||
{
|
||||
debug_SetThreadName("UPnP");
|
||||
|
||||
// Values we want to set.
|
||||
char psPort[6];
|
||||
sprintf_s(psPort, ARRAY_SIZE(psPort), "%d", PS_DEFAULT_PORT);
|
||||
sprintf_s(psPort, ARRAY_SIZE(psPort), "%d", port);
|
||||
const char* leaseDuration = "0"; // Indefinite/permanent lease duration.
|
||||
const char* description = "0AD Multiplayer";
|
||||
const char* protocall = "UDP";
|
||||
|
|
|
|||
|
|
@ -436,7 +436,7 @@ private:
|
|||
/**
|
||||
* Try to find a UPnP root on the network and setup port forwarding.
|
||||
*/
|
||||
static void SetupUPnP();
|
||||
static void SetupUPnP(const u16 port);
|
||||
std::thread m_UPnPThread;
|
||||
#endif
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue