diff --git a/code/server/server.h b/code/server/server.h index 39d6f4d3..7ffe66ff 100644 --- a/code/server/server.h +++ b/code/server/server.h @@ -241,8 +241,10 @@ typedef struct { int nextHeartbeatTime; challenge_t challenges[MAX_CHALLENGES]; // to prevent invalid IPs from connecting netadr_t redirectAddress; // for rcon return messages - - netadr_t authorizeAddress; // for rcon return messages +#ifndef STANDALONE + netadr_t authorizeAddress; // authorize server address +#endif + int masterResolveTime[MAX_MASTER_SERVERS]; // next svs.time that server should do dns lookup for master server } serverStatic_t; #define SERVER_MAXBANS 1024 diff --git a/code/server/sv_main.c b/code/server/sv_main.c index 993910fe..0dd8ad47 100644 --- a/code/server/sv_main.c +++ b/code/server/sv_main.c @@ -236,6 +236,7 @@ but not on every player enter or exit. ================ */ #define HEARTBEAT_MSEC 300*1000 +#define MASTERDNS_MSEC 24*60*60*1000 void SV_MasterHeartbeat(const char *message) { static netadr_t adr[MAX_MASTER_SERVERS][2]; // [2] for v4 and v6 address for the same address string. @@ -264,12 +265,12 @@ void SV_MasterHeartbeat(const char *message) if(!sv_master[i]->string[0]) continue; - // see if we haven't already resolved the name - // resolving usually causes hitches on win95, so only - // do it when needed - if(sv_master[i]->modified || (adr[i][0].type == NA_BAD && adr[i][1].type == NA_BAD)) + // see if we haven't already resolved the name or if it's been over 24 hours + // resolving usually causes hitches on win95, so only do it when needed + if (sv_master[i]->modified || svs.time > svs.masterResolveTime[i]) { sv_master[i]->modified = qfalse; + svs.masterResolveTime[i] = svs.time + MASTERDNS_MSEC; if(netenabled & NET_ENABLEV4) { @@ -304,16 +305,11 @@ void SV_MasterHeartbeat(const char *message) else Com_Printf( "%s has no IPv6 address.\n", sv_master[i]->string); } + } - if(adr[i][0].type == NA_BAD && adr[i][1].type == NA_BAD) - { - // if the address failed to resolve, clear it - // so we don't take repeated dns hits - Com_Printf("Couldn't resolve address: %s\n", sv_master[i]->string); - Cvar_Set(sv_master[i]->name, ""); - sv_master[i]->modified = qfalse; - continue; - } + if(adr[i][0].type == NA_BAD && adr[i][1].type == NA_BAD) + { + continue; }