diff --git a/source/network/NetServer.cpp b/source/network/NetServer.cpp index ff6b40e469..ef75dc4fa3 100644 --- a/source/network/NetServer.cpp +++ b/source/network/NetServer.cpp @@ -194,20 +194,20 @@ bool CNetServerWorker::SetupConnection(const u16 port) #if CONFIG2_MINIUPNPC // Launch the UPnP thread - m_UPnPThread = std::thread(Threading::HandleExceptions::Wrapper); + m_UPnPThread = std::thread(Threading::HandleExceptions::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"; diff --git a/source/network/NetServer.h b/source/network/NetServer.h index 060d12a328..3aea6df80f 100644 --- a/source/network/NetServer.h +++ b/source/network/NetServer.h @@ -427,7 +427,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