From: <z-...@us...> - 2008-01-29 15:57:15
|
Revision: 7696 http://armagetronad.svn.sourceforge.net/armagetronad/?rev=7696&view=rev Author: z-man Date: 2008-01-29 07:57:18 -0800 (Tue, 29 Jan 2008) Log Message: ----------- Configuration files get reloaded on SIGHUP Modified Paths: -------------- armagetronad/branches/0.2.8/armagetronad/NEWS armagetronad/branches/0.2.8/armagetronad/language/english_base.txt armagetronad/branches/0.2.8/armagetronad/src/tools/tConfiguration.cpp armagetronad/branches/0.2.8/armagetronad/src/tron/gArmagetron.cpp Modified: armagetronad/branches/0.2.8/armagetronad/NEWS =================================================================== --- armagetronad/branches/0.2.8/armagetronad/NEWS 2008-01-29 15:11:45 UTC (rev 7695) +++ armagetronad/branches/0.2.8/armagetronad/NEWS 2008-01-29 15:57:18 UTC (rev 7696) @@ -54,6 +54,7 @@ console Featurelets: +- Configuration files get reloaded on SIGHUP - A subculture list for server groups that are not managed by our main master servers - A friends list and filter for the server browser that shows you only servers with your friends on them. Modified: armagetronad/branches/0.2.8/armagetronad/language/english_base.txt =================================================================== --- armagetronad/branches/0.2.8/armagetronad/language/english_base.txt 2008-01-29 15:11:45 UTC (rev 7695) +++ armagetronad/branches/0.2.8/armagetronad/language/english_base.txt 2008-01-29 15:57:18 UTC (rev 7696) @@ -2436,6 +2436,7 @@ config_value_changed \1 changed from \2 to \3.\n config_error_read Input error reading \1: invalid format.\n config_message_info \1 is currently set to \2.\n +config_sighup SIGHUP received, reloading configuration.\n nconfig_errror_protected No way. Only the server can change \1.\n nconfig_error_unknown Got conf message for unknown setting \1.\n\nYOU PROBABLY SHOULD UPGRADE ARMAGETRON ADVANCED!!!\n Modified: armagetronad/branches/0.2.8/armagetronad/src/tools/tConfiguration.cpp =================================================================== --- armagetronad/branches/0.2.8/armagetronad/src/tools/tConfiguration.cpp 2008-01-29 15:11:45 UTC (rev 7695) +++ armagetronad/branches/0.2.8/armagetronad/src/tools/tConfiguration.cpp 2008-01-29 15:57:18 UTC (rev 7696) @@ -41,10 +41,15 @@ #include "tRecorder.h" #include "tCommandLine.h" #include "tResourceManager.h" +#include "tToDo.h" #include <vector> #include <string.h> +#ifndef WIN32 +#include <signal.h> +#endif + /*********************************************************************** * The new Configuration interface, currently not completely implemented */ @@ -612,13 +617,17 @@ static tExtraConfigCommandLineAnalyzer s_extraAnalyzer; #endif -void st_LoadConfig() +static void st_InstallSigHupHandler(); + +void st_LoadConfig( bool printChange ) { + st_InstallSigHupHandler(); + const tPath& var = tDirectories::Var(); const tPath& config = tDirectories::Config(); const tPath& data = tDirectories::Data(); - tConfItemBase::printChange=false; + tConfItemBase::printChange=printChange; #ifdef DEDICATED tConfItemBase::printErrors=false; #endif @@ -671,7 +680,35 @@ } } +void st_LoadConfig() +{ + st_LoadConfig( false ); +} +static void st_DoHandleSigHup() +{ + con << tOutput("$config_sighup"); + st_SaveConfig(); + st_LoadConfig(); +} + +static void st_HandleSigHup( int signal ) +{ + st_ToDo( st_DoHandleSigHup ); +} + +static void st_InstallSigHupHandler() +{ +#ifndef WIN32 + static bool installed = false; + if ( !installed ) + { + signal( SIGHUP, &st_HandleSigHup ); + installed = true; + } +#endif +} + void tConfItemLine::ReadVal(std::istream &s){ tString dummy; dummy.ReadLine(s, true); Modified: armagetronad/branches/0.2.8/armagetronad/src/tron/gArmagetron.cpp =================================================================== --- armagetronad/branches/0.2.8/armagetronad/src/tron/gArmagetron.cpp 2008-01-29 15:11:45 UTC (rev 7695) +++ armagetronad/branches/0.2.8/armagetronad/src/tron/gArmagetron.cpp 2008-01-29 15:57:18 UTC (rev 7696) @@ -62,7 +62,6 @@ #include "rSDL.h" #endif - // data structure for command line parsing class gMainCommandLineAnalyzer: public tCommandLineAnalyzer { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |