MCPcopy Create free account
hub / github.com/JACoders/OpenJK / SVC_Info

Function SVC_Info

code/server/sv_main.cpp:224–248  ·  view source on GitHub ↗

================ SVC_Info Responds with a short info message that should be enough to determine if a user is interested in a server to do a full status ================ */

Source from the content-addressed store, hash-verified

222================
223*/
224static void SVC_Info( netadr_t from ) {
225 int i, count;
226 char infostring[MAX_INFO_STRING];
227
228 count = 0;
229 for ( i = 0 ; i < 1 ; i++ ) {
230 if ( svs.clients[i].state >= CS_CONNECTED ) {
231 count++;
232 }
233 }
234
235 infostring[0] = 0;
236
237 // echo back the parameter to status. so servers can use it as a challenge
238 // to prevent timed spoofed reply packets that add ghost servers
239 Info_SetValueForKey( infostring, "challenge", Cmd_Argv(1) );
240
241 Info_SetValueForKey( infostring, "protocol", va("%i", PROTOCOL_VERSION) );
242 //Info_SetValueForKey( infostring, "hostname", sv_hostname->string );
243 Info_SetValueForKey( infostring, "mapname", sv_mapname->string );
244 Info_SetValueForKey( infostring, "clients", va("%i", count) );
245 Info_SetValueForKey( infostring, "sv_maxclients", va("%i", 1) );
246
247 NET_OutOfBandPrint( NS_SERVER, from, "infoResponse\n%s", infostring );
248}
249
250
251/*

Callers 1

SV_ConnectionlessPacketFunction · 0.70

Calls 4

Info_SetValueForKeyFunction · 0.50
Cmd_ArgvFunction · 0.50
vaFunction · 0.50
NET_OutOfBandPrintFunction · 0.50

Tested by

no test coverage detected