summaryrefslogtreecommitdiff
path: root/lib/server
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2007-06-28 19:54:45 +0000
committerChris Wilson <chris+github@qwirx.com>2007-06-28 19:54:45 +0000
commit592d1e26597202ce0eed301d61981823cd7084f9 (patch)
treeb56d8942b56e754a0ca6d1bd6bcc8f0d3d8812a7 /lib/server
parente130a12a74d33d86fa61e8edaf3e3720f4f09f90 (diff)
Add a new -F option for daemons, which runs in the foreground but still
accepts multiple connections, unlike -D or SINGLEPROCESS.
Diffstat (limited to 'lib/server')
-rw-r--r--lib/server/Daemon.cpp11
-rw-r--r--lib/server/Daemon.h1
2 files changed, 10 insertions, 2 deletions
diff --git a/lib/server/Daemon.cpp b/lib/server/Daemon.cpp
index 8b1a1786..37698101 100644
--- a/lib/server/Daemon.cpp
+++ b/lib/server/Daemon.cpp
@@ -53,6 +53,7 @@ Daemon::Daemon()
mReloadConfigWanted(false),
mTerminateWanted(false),
mSingleProcess(false),
+ mRunInForeground(false),
mKeepConsoleOpenAfterFork(false)
{
if(spDaemon != NULL)
@@ -121,7 +122,7 @@ int Daemon::Main(const char *DefaultConfigFile, int argc, const char *argv[])
optreset = 1;
#endif
- while((c = getopt(argc, (char * const *)argv, "c:DqvVt:Tk")) != -1)
+ while((c = getopt(argc, (char * const *)argv, "c:DFqvVt:Tk")) != -1)
{
switch(c)
{
@@ -138,6 +139,12 @@ int Daemon::Main(const char *DefaultConfigFile, int argc, const char *argv[])
}
break;
+ case 'F':
+ {
+ mRunInForeground = true;
+ }
+ break;
+
case 'q':
{
if(masterLevel == Log::NOTHING)
@@ -250,7 +257,7 @@ int Daemon::Main(const std::string &rConfigFileName)
mConfigFileName = rConfigFileName;
- bool asDaemon = !mSingleProcess;
+ bool asDaemon = !mSingleProcess && !mRunInForeground;
try
{
diff --git a/lib/server/Daemon.h b/lib/server/Daemon.h
index c4c7af0d..bce6c3c1 100644
--- a/lib/server/Daemon.h
+++ b/lib/server/Daemon.h
@@ -79,6 +79,7 @@ private:
bool mReloadConfigWanted;
bool mTerminateWanted;
bool mSingleProcess;
+ bool mRunInForeground;
bool mKeepConsoleOpenAfterFork;
static Daemon *spDaemon;
};