From b675d8587e61023c6c3f404e691eb05ca47c08b9 Mon Sep 17 00:00:00 2001 From: Volker Fischer Date: Thu, 5 May 2011 17:45:29 +0000 Subject: [PATCH] bug fixes for local server port --- src/serverlist.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/serverlist.cpp b/src/serverlist.cpp index 1f2b1360..4f0bcbd0 100755 --- a/src/serverlist.cpp +++ b/src/serverlist.cpp @@ -290,12 +290,14 @@ void CServerListManager::CentralServerRegisterServer ( const CHostAddress& In if ( iSelIdx > iNumPredefinedServers ) { // update all data and call update registration function + ServerList[iSelIdx].iLocalPortNumber = ServerInfo.iLocalPortNumber; ServerList[iSelIdx].strName = ServerInfo.strName; ServerList[iSelIdx].strTopic = ServerInfo.strTopic; ServerList[iSelIdx].eCountry = ServerInfo.eCountry; ServerList[iSelIdx].strCity = ServerInfo.strCity; ServerList[iSelIdx].iMaxNumClients = ServerInfo.iMaxNumClients; ServerList[iSelIdx].bPermanentOnline = ServerInfo.bPermanentOnline; + ServerList[iSelIdx].UpdateRegistration(); } } @@ -359,9 +361,15 @@ void CServerListManager::CentralServerQueryServerList ( const CHostAddress& Inet // take the local port number instead of the received port // number since some NAT (network address translation) might - // have changed the port - vecServerInfo[iIdx].HostAddr.iPort = - ServerList[iIdx].iLocalPortNumber; + // have changed the port, note that the predefined servers + // are treated differently, for these we assume that the + // received port number is the same as the actual port + // number + if ( iIdx > iNumPredefinedServers ) + { + vecServerInfo[iIdx].HostAddr.iPort = + ServerList[iIdx].iLocalPortNumber; + } } else {