diff options
author | Ben Millwood <thebenmachine@gmail.com> | 2009-10-03 13:15:18 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2013-01-03 00:16:37 +0000 |
commit | 39a04df7a0477708c11dae6e45e99c6da33e20d7 (patch) | |
tree | 6a6b1729ef29fcb34370eb87d20d7314fd6e8c1a /src/server | |
parent | 26767f1713a6e1b12263c37f0659d527caf41a65 (diff) |
* Convert master address resolution to IPv6-compatible API
* MOTD parsing should use the whole string rather than just arg1
Diffstat (limited to 'src/server')
-rw-r--r-- | src/server/sv_main.c | 31 |
1 files changed, 16 insertions, 15 deletions
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 ); } |