fix for server list so that IP addresses can only be present once

This commit is contained in:
Volker Fischer 2011-04-22 11:01:55 +00:00
parent 02762d6e00
commit a6f5f1f43c

View File

@ -157,14 +157,13 @@ void CServerListManager::RegisterServer ( const CHostAddress& InetAddr,
// define invalid index used as a flag // define invalid index used as a flag
const int ciInvalidIdx = -1; const int ciInvalidIdx = -1;
// Check if server is already registered. Use IP number and port // Check if server is already registered. Use IP number to identify
// number to fully identify a server. The very first list entry must // a server. The very first list entry must not be checked since
// not be checked since this is per definition the central server // this is per definition the central server (i.e., this server)
// (i.e., this server)
int iSelIdx = ciInvalidIdx; // initialize with an illegal value int iSelIdx = ciInvalidIdx; // initialize with an illegal value
for ( int iIdx = 1; iIdx < iCurServerListSize; iIdx++ ) for ( int iIdx = 1; iIdx < iCurServerListSize; iIdx++ )
{ {
if ( ServerList[iIdx].HostAddr == InetAddr ) if ( ServerList[iIdx].HostAddr.InetAddr == InetAddr.InetAddr )
{ {
// store entry index // store entry index
iSelIdx = iIdx; iSelIdx = iIdx;