From 39a04df7a0477708c11dae6e45e99c6da33e20d7 Mon Sep 17 00:00:00 2001 From: Ben Millwood Date: Sat, 3 Oct 2009 13:15:18 +0000 Subject: * Convert master address resolution to IPv6-compatible API * MOTD parsing should use the whole string rather than just arg1 --- src/server/sv_main.c | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) (limited to 'src/server/sv_main.c') diff --git a/src/server/sv_main.c b/src/server/sv_main.c index 01da0f5d..305cf299 100644 --- a/src/server/sv_main.c +++ b/src/server/sv_main.c @@ -299,28 +299,29 @@ SV_MasterGameStat */ void SV_MasterGameStat( const char *data ) { - static netadr_t adr; + netadr_t adr; - if( !com_dedicated || com_dedicated->integer != 2 ) - return; // only dedicated servers send stats + 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, NA_IP ) ) - { - Com_Printf( "Couldn't resolve address: %s\n", MASTER_SERVER_NAME ); - return; - } - else + + switch( NET_StringToAdr( MASTER_SERVER_NAME, &adr, NA_UNSPEC ) ) { - if( !strstr( ":", MASTER_SERVER_NAME ) ) - adr.port = BigShort( PORT_MASTER ); + case 0: + Com_Printf( "Couldn't resolve master address: %s\n", MASTER_SERVER_NAME ); + return; - 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 ) ); + case 2: + adr.port = BigShort( PORT_MASTER ); + default: + break; } - Com_Printf ("Sending gamestat to %s\n", MASTER_SERVER_NAME ); + Com_Printf( "%s resolved to %s\n", MASTER_SERVER_NAME, + NET_AdrToStringwPort( adr ) ); + + Com_Printf( "Sending gamestat to %s\n", MASTER_SERVER_NAME ); NET_OutOfBandPrint( NS_SERVER, adr, "gamestat %s", data ); } -- cgit