server keepalive fix

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6119 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
Lee Salzman
2011-03-08 15:30:50 +00:00
parent 53cb968efc
commit 109621491e
+4 -2
View File
@@ -162,8 +162,9 @@ struct client
enet_uint32 lastauth; // for AUTH
vector<authreq> authreqs; // for AUTH
bool shouldpurge;
bool registeredserver;
client() : message(NULL), inputpos(0), outputpos(0), servport(-1), lastauth(0), shouldpurge(false) {}
client() : message(NULL), inputpos(0), outputpos(0), servport(-1), lastauth(0), shouldpurge(false), registeredserver(false) {}
};
vector<client *> clients;
@@ -384,6 +385,7 @@ void checkserverpongs()
client *c = findclient(s);
if(c)
{
c->registeredserver = true;
outputf(*c, "succreg\n");
if(!c->message && gbanlists.length())
{
@@ -685,7 +687,7 @@ void checkclients()
else { purgeclient(i--); continue; }
}
if(c.output.length() > OUTPUT_LIMIT) { purgeclient(i--); continue; }
if(ENET_TIME_DIFFERENCE(servtime, c.lastinput) >= CLIENT_TIME) { purgeclient(i--); continue; }
if(ENET_TIME_DIFFERENCE(servtime, c.lastinput) >= (c.registeredserver ? KEEPALIVE_TIME : CLIENT_TIME)) { purgeclient(i--); continue; }
}
}