/* ================ SV_Shutdown Called when each game quits, before Sys_Quit or Sys_Error ================ */ void SV_Shutdown( char *finalmsg ) { if ( !com_sv_running || !com_sv_running->integer ) { return; } Com_Printf( "----- Server Shutdown (%s) -----\n", finalmsg ); NET_LeaveMulticast6(); if ( svs.clients && !com_errorEntered ) { SV_FinalMessage( finalmsg ); } SV_RemoveOperatorCommands(); SV_MasterShutdown(); SV_ShutdownGameProgs(); // free current level SV_ClearServer(); // free server static data if ( svs.clients ) { Z_Free( svs.clients ); } Com_Memset( &svs, 0, sizeof( svs ) ); Cvar_Set( "sv_running", "0" ); Cvar_Set("ui_singlePlayerActive", "0"); Com_Printf( "---------------------------\n" ); // disconnect any local clients if( sv_killserver->integer != 2 ) CL_Disconnect( qfalse ); }
/* ================ SV_Shutdown Called when each game quits, before Sys_Quit or Sys_Error ================ */ void SV_Shutdown( char *finalmsg ) { if ( !com_sv_running || !com_sv_running->integer ) { return; } Com_Printf( "----- Server Shutdown (%s) -----\n", finalmsg ); NET_LeaveMulticast6(); if ( svs.clients && !com_errorEntered ) { SV_FinalMessage( finalmsg ); } SV_RemoveOperatorCommands(); SV_MasterShutdown(); SV_ShutdownGameProgs(); #ifdef DEDICATED Com_ShutdownRef(); #endif MSG_ShutdownNetFields(); // free current level SV_ClearServer(); // free server static data if(svs.players) { int index; for(index = 0; index < sv_maxclients->integer; index++) SV_FreePlayer(&svs.players[index]); Z_Free(svs.players); } if(svs.clients) { int index; for(index = 0; index < sv_maxclients->integer; index++) SV_FreeClient(&svs.clients[index]); Z_Free(svs.clients); } Com_Memset( &svs, 0, sizeof( svs ) ); Cvar_Set( "sv_running", "0" ); Cvar_Set("ui_singlePlayerActive", "0"); Cvar_Set("sv_public", "0"); Com_Printf( "---------------------------\n" ); // disconnect any local clients if( sv_killserver->integer != 2 ) CL_Disconnect( qfalse ); }
/* ================ SV_Shutdown Called when each game quits, before Sys_Quit or Sys_Error ================ */ void SV_Shutdown( const char *finalmsg ) { if ( !com_sv_running || !com_sv_running->integer ) { return; } PrintBanner(_( "Server Shutdown" )) NET_LeaveMulticast6(); if ( svs.clients && !com_errorEntered ) { SV_FinalCommand( va( "print %s", Cmd_QuoteString( finalmsg ) ), qtrue ); } SV_RemoveOperatorCommands(); SV_MasterShutdown(); SV_ShutdownGameProgs(); // free current level SV_ClearServer(); // free server static data if ( svs.clients ) { int index; for ( index = 0; index < sv_maxclients->integer; index++ ) { SV_FreeClient( &svs.clients[ index ] ); } //Z_Free( svs.clients ); free( svs.clients ); // RF, avoid trying to allocate large chunk on a fragmented zone } memset( &svs, 0, sizeof( svs ) ); svs.serverLoad = -1; Cvar_Set( "sv_running", "0" ); #ifndef DEDICATED NET_Config( qtrue ); #endif Com_Printf( "---------------------------\n" ); // disconnect any local clients CL_Disconnect( qfalse ); }
/* ================ SV_Shutdown Called when each game quits, before Sys_Quit or Sys_Error ================ */ void SV_Shutdown( const char *finalmsg ) { if ( !com_sv_running || !com_sv_running->integer ) { return; } PrintBanner( "Server Shutdown" ) NET_LeaveMulticast6(); if ( svs.clients ) { SV_FinalCommand( va( "print %s", Cmd_QuoteString( finalmsg ) ), true ); } SV_RemoveOperatorCommands(); SV_MasterShutdown(); SV_ShutdownGameProgs(); // free current level SV_ClearServer(); // free server static data if ( svs.clients ) { int index; for ( index = 0; index < sv_maxclients->integer; index++ ) { SV_FreeClient( &svs.clients[ index ] ); } free( svs.clients ); } memset( &svs, 0, sizeof( svs ) ); svs.serverLoad = -1; Cvar_Set( "sv_running", "0" ); #ifndef BUILD_SERVER NET_Config( true ); #endif Com_Printf( "---------------------------\n" ); // disconnect any local clients CL_Disconnect( false ); }
// Called when each game quits, before Sys_Quit or Sys_Error void SV_Shutdown( const char *finalmsg ) { if ( !com_sv_running || !com_sv_running->integer ) { return; } Com_Printf( "----- Server Shutdown (%s) -----\n", finalmsg ); NET_LeaveMulticast6(); if ( svs.clients && !com_errorEntered ) { SV_FinalMessage( finalmsg ); } SV_RemoveOperatorCommands(); SV_MasterShutdown(); SV_ShutdownGameProgs(); svs.gameStarted = qfalse; // free current level SV_ClearServer(); // free server static data if(svs.clients) { int index; for(index = 0; index < sv_maxclients->integer; index++) SV_FreeClient(&svs.clients[index]); Z_Free(svs.clients); } memset( &svs, 0, sizeof( svs ) ); Cvar_Set( "sv_running", "0" ); Com_Printf( "---------------------------\n" ); // disconnect any local clients if( sv_killserver->integer != 2 ) CL_Disconnect( qfalse, "Server shutdown" ); }