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

Function SV_Shutdown

code/server/sv_init.cpp:451–495  ·  view source on GitHub ↗

================ SV_Shutdown Called when each game quits, before Sys_Quit or Sys_Error ================ */

Source from the content-addressed store, hash-verified

449================
450*/
451void SV_Shutdown( const char *finalmsg ) {
452 int i;
453
454 if ( !com_sv_running || !com_sv_running->integer ) {
455 return;
456 }
457
458 //Com_Printf( "----- Server Shutdown -----\n" );
459
460 if ( svs.clients && !com_errorEntered ) {
461 SV_FinalMessage( finalmsg );
462 }
463
464 SV_RemoveOperatorCommands();
465 SV_ShutdownGameProgs(qfalse);
466
467 if (svs.snapshotEntities)
468 {
469 Z_Free(svs.snapshotEntities);
470 svs.snapshotEntities = NULL;
471 }
472
473 for ( i = 0 ; i < MAX_CONFIGSTRINGS ; i++ ) {
474 if ( sv.configstrings[i] ) {
475 Z_Free( sv.configstrings[i] );
476 }
477 }
478
479 // free current level
480 memset( &sv, 0, sizeof( sv ) );
481
482 // free server static data
483 if ( svs.clients ) {
484 SV_FreeClient(svs.clients);
485 Z_Free( svs.clients );
486 }
487 memset( &svs, 0, sizeof( svs ) );
488
489 // Ensure we free any memory used by the leaf cache.
490 CM_CleanLeafCache();
491
492 Cvar_Set( "sv_running", "0" );
493
494 //Com_Printf( "---------------------------\n" );
495}
496

Callers 5

SV_FrameFunction · 0.70
Sys_SigHandlerFunction · 0.50
Com_ErrorFunction · 0.50
Com_Quit_fFunction · 0.50
Com_CatchErrorFunction · 0.50

Calls 7

SV_FreeClientFunction · 0.85
CM_CleanLeafCacheFunction · 0.85
SV_FinalMessageFunction · 0.70
SV_ShutdownGameProgsFunction · 0.70
Z_FreeFunction · 0.50
Cvar_SetFunction · 0.50

Tested by

no test coverage detected