From 7654438033bc7242e6bd9e835a5f8893dd9ff7ce Mon Sep 17 00:00:00 2001 From: def Date: Fri, 15 Aug 2014 14:32:21 +0200 Subject: [PATCH] Add sv_shutdown_when_empty --- src/engine/server/server.cpp | 7 ++++++- src/engine/shared/config_variables.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/engine/server/server.cpp b/src/engine/server/server.cpp index cf137bffa..a77de6e80 100644 --- a/src/engine/server/server.cpp +++ b/src/engine/server/server.cpp @@ -1691,7 +1691,12 @@ int CServer::Run() // wait for incoming data if (NonActive) - net_socket_read_wait(m_NetServer.Socket(), 1000); + { + if(g_Config.m_SvShutdownWhenEmpty) + m_RunServer = false; + else + net_socket_read_wait(m_NetServer.Socket(), 1000); + } else net_socket_read_wait(m_NetServer.Socket(), 5); } diff --git a/src/engine/shared/config_variables.h b/src/engine/shared/config_variables.h index 948f17a65..9c35d4973 100644 --- a/src/engine/shared/config_variables.h +++ b/src/engine/shared/config_variables.h @@ -297,6 +297,7 @@ MACRO_CONFIG_INT(SvSpamMuteDuration, sv_spam_mute_duration, 60, 0, 3600 , CFGFLA MACRO_CONFIG_INT(SvEvents, sv_events, 1, 0, 1, CFGFLAG_SERVER, "Enable triggering of server events, like the happy eyeemotes on some holidays.") MACRO_CONFIG_INT(SvRankCheats, sv_rank_cheats, 0, 0, 1, CFGFLAG_SERVER, "Enable ranks after cheats have been used (file based server only)") MACRO_CONFIG_INT(SvSpoofProtection, sv_spoof_protection, 0, 1, 1, CFGFLAG_SERVER, "Enable spoof protection") +MACRO_CONFIG_INT(SvShutdownWhenEmpty, sv_shutdown_when_empty, 0, 0, 1, CFGFLAG_SERVER, "Shutdown server as soon as noone is on it anymore") // netlimit MACRO_CONFIG_INT(SvNetlimit, sv_netlimit, 0, 0, 10000, CFGFLAG_SERVER, "Netlimit: Maximum amount of traffic a client is allowed to use (in kb/s)")