From 473e79c356f3e5d1cf3cb6b0a54994232949fc4a Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Tue, 11 Jun 2013 00:07:28 +0000 Subject: [PATCH] add lag pause when client lag reaches warning level --- source/glest_game/network/server_interface.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/source/glest_game/network/server_interface.cpp b/source/glest_game/network/server_interface.cpp index 7ff9e80ba..a3f31c7cb 100644 --- a/source/glest_game/network/server_interface.cpp +++ b/source/glest_game/network/server_interface.cpp @@ -1134,6 +1134,20 @@ void ServerInterface::checkForLaggingClients(std::map &mapSlotSignalle if(clientLagExceededOrWarned.first == true) { slotsWarnedList[i] = true; } + + // If the client has exceeded lag and the server wants + // to pause while they catch up, re-trigger the + // client reader thread + if((clientLagExceededOrWarned.first == true && + gameSettings.getNetworkPauseGameForLaggedClients() == true)) { + if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d, clientLagExceededOrWarned.first = %d, clientLagExceededOrWarned.second = %d, difftime(time(NULL),waitForClientsElapsed) = %.2f, MAX_CLIENT_WAIT_SECONDS_FOR_PAUSE = %.2f\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,clientLagExceededOrWarned.first,clientLagExceededOrWarned.second,difftime((long int)time(NULL),waitForClientsElapsed),MAX_CLIENT_WAIT_SECONDS_FOR_PAUSE); + + if(difftime((long int)time(NULL),waitForClientsElapsed) < MAX_CLIENT_WAIT_SECONDS_FOR_PAUSE) { + if(connectionSlot != NULL) { + threadsDone = false; + } + } + } } } }