summaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
Diffstat (limited to 'src/server')
-rw-r--r--src/server/server.h1
-rw-r--r--src/server/sv_game.c4
-rw-r--r--src/server/sv_main.c31
3 files changed, 36 insertions, 0 deletions
diff --git a/src/server/server.h b/src/server/server.h
index da8c8aae..45e199f7 100644
--- a/src/server/server.h
+++ b/src/server/server.h
@@ -261,6 +261,7 @@ void SV_RemoveOperatorCommands (void);
void SV_MasterHeartbeat (void);
void SV_MasterShutdown (void);
+void SV_MasterGameStat( const char *data );
diff --git a/src/server/sv_game.c b/src/server/sv_game.c
index a0ccc0f7..cefcddeb 100644
--- a/src/server/sv_game.c
+++ b/src/server/sv_game.c
@@ -446,6 +446,10 @@ long SV_GameSystemCalls( long *args ) {
Sys_SnapVector( VMA(1) );
return 0;
+ case G_SEND_GAMESTAT:
+ SV_MasterGameStat( VMA(1) );
+ return 0;
+
//====================================
case BOTLIB_SETUP:
diff --git a/src/server/sv_main.c b/src/server/sv_main.c
index 1d658a60..d017e7b1 100644
--- a/src/server/sv_main.c
+++ b/src/server/sv_main.c
@@ -293,6 +293,37 @@ void SV_MasterShutdown( void ) {
// it will be removed from the list
}
+/*
+=================
+SV_MasterGameStat
+=================
+*/
+void SV_MasterGameStat( const char *data )
+{
+ static netadr_t adr;
+
+ if( !com_dedicated || com_dedicated->integer != 2 )
+ return; // only dedicated servers send stats
+
+ Com_Printf( "Resolving %s\n", MASTER_SERVER_NAME );
+ if( !NET_StringToAdr( MASTER_SERVER_NAME, &adr ) )
+ {
+ Com_Printf( "Couldn't resolve address: %s\n", MASTER_SERVER_NAME );
+ return;
+ }
+ else
+ {
+ if( !strstr( ":", MASTER_SERVER_NAME ) )
+ adr.port = BigShort( PORT_MASTER );
+
+ Com_Printf( "%s resolved to %i.%i.%i.%i:%i\n", MASTER_SERVER_NAME,
+ adr.ip[0], adr.ip[1], adr.ip[2], adr.ip[3],
+ BigShort( adr.port ) );
+ }
+
+ Com_Printf ("Sending gamestat to %s\n", MASTER_SERVER_NAME );
+ NET_OutOfBandPrint( NS_SERVER, adr, "gamestat %s", data );
+}
/*
==============================================================================