Author: chris
Date: 2007-04-28 18:32:24 +0100 (Sat, 28 Apr 2007)
New Revision: 1591
Modified:
box/chris/merge/lib/server/Daemon.cpp
box/chris/merge/lib/server/Daemon.h
Log:
Make Daemon remember whether we're supposed to run in a single process,
or not. (refs #3)
Modified: box/chris/merge/lib/server/Daemon.cpp
===================================================================
--- box/chris/merge/lib/server/Daemon.cpp 2007-04-28 17:31:38 UTC (rev 1590)
+++ box/chris/merge/lib/server/Daemon.cpp 2007-04-28 17:32:24 UTC (rev 1591)
@@ -101,7 +101,6 @@
// Find filename of config file
mConfigFileName = DefaultConfigFile;
bool haveConfigFile = false;
- bool singleProcess = false;
#ifdef NDEBUG
int masterLevel = Log::NOTICE; // need an int to do math with
@@ -125,7 +124,7 @@
case 'D':
{
- singleProcess = true;
+ mSingleProcess = true;
}
break;
@@ -203,7 +202,7 @@
if (argc > optind && ::strcmp(argv[optind], "SINGLEPROCESS") == 0)
{
- singleProcess = true; optind++;
+ mSingleProcess = true; optind++;
}
if (argc > optind)
@@ -215,19 +214,20 @@
Logging::SetGlobalLevel((Log::Level)masterLevel);
- return Main(mConfigFileName, singleProcess);
+ // return Main(mConfigFileName, mSingleProcess);
+ return Main(mConfigFileName);
}
// --------------------------------------------------------------------------
//
// Function
-// Name: Daemon::Main(const std::string& rConfigFileName,
-// bool singleProcess)
+// Name: Daemon::Main(const std::string& rConfigFileName)
// Purpose: Starts the daemon off -- equivalent of C main() function
// Created: 2003/07/29
//
// --------------------------------------------------------------------------
-int Daemon::Main(const std::string &rConfigFileName, bool singleProcess)
+// int Daemon::Main(const std::string &rConfigFileName, bool singleProcess)
+int Daemon::Main(const std::string &rConfigFileName)
{
// Banner (optional)
{
@@ -241,7 +241,8 @@
std::string pidFileName;
mConfigFileName = rConfigFileName;
- bool asDaemon = !singleProcess;
+
+ bool asDaemon = !mSingleProcess;
try
{
Modified: box/chris/merge/lib/server/Daemon.h
===================================================================
--- box/chris/merge/lib/server/Daemon.h 2007-04-28 17:31:38 UTC (rev 1590)
+++ box/chris/merge/lib/server/Daemon.h 2007-04-28 17:32:24 UTC (rev 1591)
@@ -41,7 +41,8 @@
public:
int Main(const char *DefaultConfigFile, int argc, const char *argv[]);
- int Main(const std::string &rConfigFile, bool singleProcess);
+ // int Main(const std::string &rConfigFile, bool singleProcess);
+ int Main(const std::string &rConfigFile);
virtual void Run();
const Configuration &GetConfiguration() const;
@@ -66,6 +67,7 @@
protected:
box_time_t GetLoadedConfigModifiedTime() const;
+ bool IsSingleProcess() { return mSingleProcess; }
private:
static void SignalHandler(int sigraised);
@@ -77,6 +79,7 @@
box_time_t mLoadedConfigModifiedTime;
bool mReloadConfigWanted;
bool mTerminateWanted;
+ bool mSingleProcess;
bool mKeepConsoleOpenAfterFork;
static Daemon *spDaemon;
};