- attempt to add a client LAG checker to notify and disconnect clients that fall too far behind.

This commit is contained in:
Mark Vejvoda
2010-06-15 05:36:07 +00:00
parent b3b2d098b7
commit e091460f40
10 changed files with 157 additions and 80 deletions

View File

@@ -152,6 +152,9 @@ ConnectionSlot::ConnectionSlot(ServerInterface* serverInterface, int playerIndex
this->serverInterface = serverInterface;
this->playerIndex = playerIndex;
this->currentFrameCount = 0;
this->currentLagCount = 0;
this->lastReceiveCommandListTime = 0;
this->socket = NULL;
this->slotThreadWorker = NULL;
this->slotThreadWorker = new ConnectionSlotThread(this->serverInterface);
@@ -274,6 +277,10 @@ void ConnectionSlot::update(bool checkForNewClients) {
NetworkMessageCommandList networkMessageCommandList;
if(receiveMessage(&networkMessageCommandList)) {
currentFrameCount = networkMessageCommandList.getFrameCount();
lastReceiveCommandListTime = time(NULL);
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] currentFrameCount = %d\n",__FILE__,__FUNCTION__,__LINE__,currentFrameCount);
for(int i= 0; i<networkMessageCommandList.getCommandCount(); ++i) {
//serverInterface->requestCommand(networkMessageCommandList.getCommand(i));
vctPendingNetworkCommandList.push_back(*networkMessageCommandList.getCommand(i));