Browse Source

engine: restore sv_hibernate_when_empty

pull/211/head
tyabus 2 years ago
parent
commit
4e87659a1d
  1. 21
      engine/sv_main.cpp

21
engine/sv_main.cpp

@ -80,8 +80,8 @@
extern CNetworkStringTableContainer *networkStringTableContainerServer; extern CNetworkStringTableContainer *networkStringTableContainerServer;
extern CNetworkStringTableContainer *networkStringTableContainerClient; extern CNetworkStringTableContainer *networkStringTableContainerClient;
//void OnHibernateWhenEmptyChanged( IConVar *var, const char *pOldValue, float flOldValue ); static void OnHibernateWhenEmptyChanged( IConVar *var, const char *pOldValue, float flOldValue );
//ConVar sv_hibernate_when_empty( "sv_hibernate_when_empty", "1", 0, "Puts the server into extremely low CPU usage mode when no clients connected", OnHibernateWhenEmptyChanged ); ConVar sv_hibernate_when_empty( "sv_hibernate_when_empty", "1", 0, "Puts the server into extremely low CPU usage mode when no clients connected", OnHibernateWhenEmptyChanged );
//ConVar sv_hibernate_ms( "sv_hibernate_ms", "20", 0, "# of milliseconds to sleep per frame while hibernating" ); //ConVar sv_hibernate_ms( "sv_hibernate_ms", "20", 0, "# of milliseconds to sleep per frame while hibernating" );
//ConVar sv_hibernate_ms_vgui( "sv_hibernate_ms_vgui", "20", 0, "# of milliseconds to sleep per frame while hibernating but running the vgui dedicated server frontend" ); //ConVar sv_hibernate_ms_vgui( "sv_hibernate_ms_vgui", "20", 0, "# of milliseconds to sleep per frame while hibernating but running the vgui dedicated server frontend" );
//static ConVar sv_hibernate_postgame_delay( "sv_hibernate_postgame_delay", "5", 0, "# of seconds to wait after final client leaves before hibernating."); //static ConVar sv_hibernate_postgame_delay( "sv_hibernate_postgame_delay", "5", 0, "# of seconds to wait after final client leaves before hibernating.");
@ -1541,13 +1541,13 @@ CPureServerWhitelist * CGameServer::GetPureServerWhitelist() const
return m_pPureServerWhitelist; return m_pPureServerWhitelist;
} }
//void OnHibernateWhenEmptyChanged( IConVar *var, const char *pOldValue, float flOldValue ) static void OnHibernateWhenEmptyChanged( IConVar *var, const char *pOldValue, float flOldValue )
//{ {
// // We only need to do something special if we were preventing hibernation // We only need to do something special if we were preventing hibernation
// // with sv_hibernate_when_empty but we would otherwise have been hibernating. // with sv_hibernate_when_empty but we would otherwise have been hibernating.
// // In that case, punt all connected clients. // In that case, punt all connected clients.
// sv.UpdateHibernationState( ); sv.UpdateHibernationState( );
//} }
static bool s_bExitWhenEmpty = false; static bool s_bExitWhenEmpty = false;
static ConVar sv_memlimit( "sv_memlimit", "0", 0, static ConVar sv_memlimit( "sv_memlimit", "0", 0,
@ -1753,8 +1753,7 @@ void CGameServer::UpdateHibernationState()
s_bExitWhenEmpty = true; s_bExitWhenEmpty = true;
} }
//SetHibernating( sv_hibernate_when_empty.GetBool() && hibernateFromGCServer && !bHaveAnyClients ); SetHibernating( sv_hibernate_when_empty.GetBool() && hibernateFromGCServer && !bHaveAnyClients );
SetHibernating( hibernateFromGCServer && !bHaveAnyClients );
} }
void CGameServer::FinishRestore() void CGameServer::FinishRestore()

Loading…
Cancel
Save