try to fix an issue that people do not see their server on the same PC anymore
This commit is contained in:
parent
b080378c06
commit
61e1a73f67
1 changed files with 15 additions and 2 deletions
|
@ -431,9 +431,22 @@ void CServerListManager::CentralServerQueryServerList ( const CHostAddress& Inet
|
||||||
// otherwise, use the supplied details
|
// otherwise, use the supplied details
|
||||||
if ( iIdx > iNumPredefinedServers )
|
if ( iIdx > iNumPredefinedServers )
|
||||||
{
|
{
|
||||||
vecServerInfo[iIdx].HostAddr.InetAddr =
|
// check for server running on the same PC
|
||||||
ServerList[iIdx].LHostAddr.InetAddr;
|
if ( vecServerInfo[iIdx].HostAddr.iPort == InetAddr.iPort )
|
||||||
|
{
|
||||||
|
vecServerInfo[iIdx].HostAddr.InetAddr =
|
||||||
|
QHostAddress ( QHostAddress::LocalHost );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// we are not on the same PC but in the same local network
|
||||||
|
vecServerInfo[iIdx].HostAddr.InetAddr =
|
||||||
|
ServerList[iIdx].LHostAddr.InetAddr;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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 =
|
vecServerInfo[iIdx].HostAddr.iPort =
|
||||||
ServerList[iIdx].iLocalPortNumber;
|
ServerList[iIdx].iLocalPortNumber;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue