- Add cvars cl_gamename, sv_heartbeat, sv_flatline so standalone games can customise their messages to the master server

This commit is contained in:
Thilo Schulz 2011-02-04 13:25:51 +00:00
parent 0eb5d1720c
commit 67a8b273c2
6 changed files with 60 additions and 18 deletions

View file

@ -58,6 +58,9 @@ cvar_t *sv_floodProtect;
cvar_t *sv_lanForceRate; // dedicated 1 (LAN) server forces local client rates to 99999 (bug #491)
cvar_t *sv_strictAuth;
cvar_t *sv_banFile;
cvar_t *sv_heartbeat; // Heartbeat string that is sent to the master
cvar_t *sv_flatline; // If the master server supports it we can send a flatline
// when server is killed
serverBan_t serverBans[SERVER_MAXBANS];
int serverBansCount = 0;
@ -232,7 +235,8 @@ but not on every player enter or exit.
================
*/
#define HEARTBEAT_MSEC 300*1000
void SV_MasterHeartbeat( void ) {
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.
int i;
int res;
@ -315,9 +319,9 @@ void SV_MasterHeartbeat( void ) {
// ever incompatably changes
if(adr[i][0].type != NA_BAD)
NET_OutOfBandPrint( NS_SERVER, adr[i][0], "heartbeat %s\n", HEARTBEAT_FOR_MASTER );
NET_OutOfBandPrint( NS_SERVER, adr[i][0], "heartbeat %s\n", message);
if(adr[i][1].type != NA_BAD)
NET_OutOfBandPrint( NS_SERVER, adr[i][1], "heartbeat %s\n", HEARTBEAT_FOR_MASTER );
NET_OutOfBandPrint( NS_SERVER, adr[i][1], "heartbeat %s\n", message);
}
}
@ -331,11 +335,11 @@ Informs all masters that this server is going down
void SV_MasterShutdown( void ) {
// send a hearbeat right now
svs.nextHeartbeatTime = -9999;
SV_MasterHeartbeat();
SV_MasterHeartbeat(sv_flatline->string);
// send it again to minimize chance of drops
svs.nextHeartbeatTime = -9999;
SV_MasterHeartbeat();
SV_MasterHeartbeat(sv_flatline->string);
// when the master tries to poll the server, it won't respond, so
// it will be removed from the list
@ -1139,7 +1143,7 @@ void SV_Frame( int msec ) {
SV_SendClientMessages();
// send a heartbeat to the master if needed
SV_MasterHeartbeat();
SV_MasterHeartbeat(sv_heartbeat->string);
}
//============================================================================