summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2007-04-28 17:32:24 +0000
committerChris Wilson <chris+github@qwirx.com>2007-04-28 17:32:24 +0000
commit503d68413c525aa84430c9e6c6b27eee1eaefbe4 (patch)
treea9e262413394c44bd55416da47f84a9e8aae30c9 /lib
parent41b16f3b27f87d2f84e59387e78644c05756e307 (diff)
Make Daemon remember whether we're supposed to run in a single process,
or not. (refs #3)
Diffstat (limited to 'lib')
-rw-r--r--lib/server/Daemon.cpp17
-rw-r--r--lib/server/Daemon.h5
2 files changed, 13 insertions, 9 deletions
diff --git a/lib/server/Daemon.cpp b/lib/server/Daemon.cpp
index c639309a..4cb33c57 100644
--- a/lib/server/Daemon.cpp
+++ b/lib/server/Daemon.cpp
@@ -101,7 +101,6 @@ int Daemon::Main(const char *DefaultConfigFile, int argc, const char *argv[])
// 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 @@ int Daemon::Main(const char *DefaultConfigFile, int argc, const char *argv[])
case 'D':
{
- singleProcess = true;
+ mSingleProcess = true;
}
break;
@@ -203,7 +202,7 @@ int Daemon::Main(const char *DefaultConfigFile, int argc, const char *argv[])
if (argc > optind && ::strcmp(argv[optind], "SINGLEPROCESS") == 0)
{
- singleProcess = true; optind++;
+ mSingleProcess = true; optind++;
}
if (argc > optind)
@@ -215,19 +214,20 @@ int Daemon::Main(const char *DefaultConfigFile, int argc, const char *argv[])
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 @@ int Daemon::Main(const std::string &rConfigFileName, bool singleProcess)
std::string pidFileName;
mConfigFileName = rConfigFileName;
- bool asDaemon = !singleProcess;
+
+ bool asDaemon = !mSingleProcess;
try
{
diff --git a/lib/server/Daemon.h b/lib/server/Daemon.h
index 52bab257..2ce24cfe 100644
--- a/lib/server/Daemon.h
+++ b/lib/server/Daemon.h
@@ -41,7 +41,8 @@ private:
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 @@ public:
protected:
box_time_t GetLoadedConfigModifiedTime() const;
+ bool IsSingleProcess() { return mSingleProcess; }
private:
static void SignalHandler(int sigraised);
@@ -77,6 +79,7 @@ private:
box_time_t mLoadedConfigModifiedTime;
bool mReloadConfigWanted;
bool mTerminateWanted;
+ bool mSingleProcess;
bool mKeepConsoleOpenAfterFork;
static Daemon *spDaemon;
};