fix for server list so that IP addresses can only be present once
This commit is contained in:
parent
02762d6e00
commit
a6f5f1f43c
1 changed files with 5 additions and 6 deletions
|
@ -150,21 +150,20 @@ void CServerListManager::RegisterServer ( const CHostAddress& InetAddr,
|
||||||
if ( bIsCentralServer && bEnabled )
|
if ( bIsCentralServer && bEnabled )
|
||||||
{
|
{
|
||||||
const int iCurServerListSize = ServerList.size();
|
const int iCurServerListSize = ServerList.size();
|
||||||
|
|
||||||
// check for maximum allowed number of servers in the server list
|
// check for maximum allowed number of servers in the server list
|
||||||
if ( iCurServerListSize < MAX_NUM_SERVERS_IN_SERVER_LIST )
|
if ( iCurServerListSize < MAX_NUM_SERVERS_IN_SERVER_LIST )
|
||||||
{
|
{
|
||||||
// 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;
|
||||||
|
|
Loading…
Reference in a new issue