respond to pong always, re-register only in intermissions or if >1 hour since last

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@5554 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
flowtron
2010-08-07 18:02:30 +00:00
parent 33cc3a48d6
commit 45f36abfca
2 changed files with 4 additions and 6 deletions
+1 -4
View File
@@ -3399,8 +3399,6 @@ void linequalitystats(int elapsed)
}
}
bool msreg = true;
void serverslice(uint timeout) // main server update, called from cube main loop in sp, or dedicated server loop
{
static int msend = 0, mrec = 0, csend = 0, crec = 0, mnum = 0, cnum = 0;
@@ -3460,7 +3458,6 @@ void serverslice(uint timeout) // main server update, called from cube main lo
loggamestatus("game finished");
if(demorecord) enddemorecord();
interm = nextsendscore = 0;
msreg = true;
//start next game
if(nextmapname[0]) startgame(nextmapname, nextgamemode);
@@ -3472,7 +3469,7 @@ void serverslice(uint timeout) // main server update, called from cube main lo
if(!isdedicated) return; // below is network only
if (msreg || !totalclients) serverms(smode, numclients(), minremain, smapname, servmillis, serverhost->address, &mnum, &msend, &mrec, &cnum, &csend, &crec, SERVER_PROTOCOL_VERSION);
serverms(smode, numclients(), minremain, smapname, servmillis, serverhost->address, &mnum, &msend, &mrec, &cnum, &csend, &crec, SERVER_PROTOCOL_VERSION);
if(autoteam && m_teammode && !m_arena && !interm && servmillis - lastfillup > 5000 && refillteams()) lastfillup = servmillis;
+3 -2
View File
@@ -162,11 +162,12 @@ void flushmasterinput()
}
extern char *global_name;
extern int interm
// send alive signal to masterserver every hour of uptime
// send alive signal to masterserver after 40 minutes of uptime and during an intermission (so theoretically <= 1 hour) - after 1 hour at the latest.
static inline void updatemasterserver(int millis, int port)
{
if(!lastupdatemaster || millis-lastupdatemaster>40*60*1000)
if(!lastupdatemaster || (millis-lastupdatemaster>40*60*1000 && interm) || millis-lastupdatemaster>60*60*1000)
{
char servername[30]; memset(servername,'\0',30); filtertext(servername,global_name,-1,20);
if(mastername[0]) requestmasterf("regserv %d %s %d\n", port, servername[0] ? servername : "noname", AC_VERSION);