/* Processing of NetServer control messages. Such as close connection. */ #include "NetServer.h" #include #ifdef WIN32 #include #pragma comment(lib, "winmm.lib") #endif #include "timer.h" /* :COMMANDS: *Close client connection* -ID=1 -dataSize=timeout in milliseconds -extra1=client id -extra2=do not touch, used by timer */ int Server::ProcessControlMessage(NetMessage d) { switch(d.networkId) { //close client connection case 1: //This is an Event. Add this to the event queue. if (true) { EVENT_MESSAGE e; e.id=d.networkId; e.dataSize=d.dataSize; e.extra1=d.extra1; e.extra2=(unsigned long)TimerGetTime(); mEventQueue.push_back(e); } break; } return 0; } //Process the event message bool Server::ProcessEventMessage(EVENT_MESSAGE* pEncryptionState) { //Close connection to client after X seconds if (pEncryptionState->id==1) { if (TimerGetTime()-(unsigned int)pEncryptionState->extra2>(unsigned int)pEncryptionState->dataSize) { this->KillClient((short)pEncryptionState->extra1); return true; } return false; } return true; }