From 109621491eb766547336cc565644577a06e0d10b Mon Sep 17 00:00:00 2001 From: Lee Salzman Date: Tue, 8 Mar 2011 15:30:50 +0000 Subject: [PATCH] server keepalive fix git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6119 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- source/src/master.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/src/master.cpp b/source/src/master.cpp index e393c0c0..7435f728 100644 --- a/source/src/master.cpp +++ b/source/src/master.cpp @@ -162,8 +162,9 @@ struct client enet_uint32 lastauth; // for AUTH vector 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 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; } } }