mirror of
https://github.com/glest/glest-source.git
synced 2025-09-25 15:09:03 +02:00
added better handling of network connections:
- only listen for new clients on a server if an open slot exists (unconnected) - for both server and client we wait a max of 10 seconds to receive a proper intro packet or we disconnect (could have connected to / from a non glest application using the same port)
This commit is contained in:
@@ -602,7 +602,6 @@ void ServerInterface::broadcastMessageToConnectedClients(const NetworkMessage* n
|
||||
void ServerInterface::updateListen()
|
||||
{
|
||||
int openSlotCount= 0;
|
||||
|
||||
for(int i= 0; i<GameConstants::maxPlayers; ++i)
|
||||
{
|
||||
if(slots[i] != NULL && slots[i]->isConnected() == false)
|
||||
@@ -614,6 +613,20 @@ void ServerInterface::updateListen()
|
||||
serverSocket.listen(openSlotCount);
|
||||
}
|
||||
|
||||
int ServerInterface::getOpenSlotCount() {
|
||||
int openSlotCount= 0;
|
||||
|
||||
for(int i= 0; i<GameConstants::maxPlayers; ++i)
|
||||
{
|
||||
if(slots[i] != NULL && slots[i]->isConnected() == false)
|
||||
{
|
||||
++openSlotCount;
|
||||
}
|
||||
}
|
||||
|
||||
return openSlotCount;
|
||||
}
|
||||
|
||||
void ServerInterface::setGameSettings(GameSettings *serverGameSettings, bool waitForClientAck)
|
||||
{
|
||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] START gameSettingsUpdateCount = %d, waitForClientAck = %d\n",__FILE__,__FUNCTION__,gameSettingsUpdateCount,waitForClientAck);
|
||||
|
Reference in New Issue
Block a user