* Fix to a bug where servers with long uptimes (~27 days) would consume 100%

CPU if the running game did not set the nextmap cvar. This patch instead uses
  the mapname server cvar, which is guaranteed to be defined.
This commit is contained in:
Tim Angus 2006-02-23 23:10:54 +00:00
parent 0e0aac2cb6
commit d5509dcd35
2 changed files with 3 additions and 3 deletions

View file

@ -671,7 +671,7 @@ void SV_Shutdown( char *finalmsg ) {
return; return;
} }
Com_Printf( "----- Server Shutdown -----\n" ); Com_Printf( "----- Server Shutdown (%s) -----\n", finalmsg );
if ( svs.clients && !com_errorEntered ) { if ( svs.clients && !com_errorEntered ) {
SV_FinalMessage( finalmsg ); SV_FinalMessage( finalmsg );

View file

@ -808,13 +808,13 @@ void SV_Frame( int msec ) {
// 2giga-milliseconds = 23 days, so it won't be too often // 2giga-milliseconds = 23 days, so it won't be too often
if ( svs.time > 0x70000000 ) { if ( svs.time > 0x70000000 ) {
SV_Shutdown( "Restarting server due to time wrapping" ); SV_Shutdown( "Restarting server due to time wrapping" );
Cbuf_AddText( "vstr nextmap\n" ); Cbuf_AddText( va( "map %s\n", Cvar_VariableString( "mapname" ) ) );
return; return;
} }
// this can happen considerably earlier when lots of clients play and the map doesn't change // this can happen considerably earlier when lots of clients play and the map doesn't change
if ( svs.nextSnapshotEntities >= 0x7FFFFFFE - svs.numSnapshotEntities ) { if ( svs.nextSnapshotEntities >= 0x7FFFFFFE - svs.numSnapshotEntities ) {
SV_Shutdown( "Restarting server due to numSnapshotEntities wrapping" ); SV_Shutdown( "Restarting server due to numSnapshotEntities wrapping" );
Cbuf_AddText( "vstr nextmap\n" ); Cbuf_AddText( va( "map %s\n", Cvar_VariableString( "mapname" ) ) );
return; return;
} }