[Box Backup-commit] COMMIT r1741 - box/chris/general/lib/server

boxbackup-dev@fluffy.co.uk boxbackup-dev@fluffy.co.uk
Thu, 26 Jul 2007 22:35:52 +0100


Author: chris
Date: 2007-07-26 22:35:52 +0100 (Thu, 26 Jul 2007)
New Revision: 1741

Modified:
   box/chris/general/lib/server/Daemon.cpp
   box/chris/general/lib/server/Daemon.h
Log:
Add a new -F option for daemons, which runs in the foreground but still
accepts multiple connections, unlike -D or SINGLEPROCESS. (refs #3,
merges [1707])


Modified: box/chris/general/lib/server/Daemon.cpp
===================================================================
--- box/chris/general/lib/server/Daemon.cpp	2007-07-26 21:35:26 UTC (rev 1740)
+++ box/chris/general/lib/server/Daemon.cpp	2007-07-26 21:35:52 UTC (rev 1741)
@@ -53,6 +53,7 @@
 	  mReloadConfigWanted(false),
 	  mTerminateWanted(false),
 	  mSingleProcess(false),
+	  mRunInForeground(false),
 	  mKeepConsoleOpenAfterFork(false)
 {
 	if(spDaemon != NULL)
@@ -121,7 +122,7 @@
 		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 @@
 			}
 			break;
 
+			case 'F':
+			{
+				mRunInForeground = true;
+			}
+			break;
+
 			case 'q':
 			{
 				if(masterLevel == Log::NOTHING)
@@ -250,7 +257,7 @@
 
 	mConfigFileName = rConfigFileName;
 	
-	bool asDaemon   = !mSingleProcess;
+	bool asDaemon   = !mSingleProcess && !mRunInForeground;
 
 	try
 	{

Modified: box/chris/general/lib/server/Daemon.h
===================================================================
--- box/chris/general/lib/server/Daemon.h	2007-07-26 21:35:26 UTC (rev 1740)
+++ box/chris/general/lib/server/Daemon.h	2007-07-26 21:35:52 UTC (rev 1741)
@@ -79,6 +79,7 @@
 	bool mReloadConfigWanted;
 	bool mTerminateWanted;
 	bool mSingleProcess;
+	bool mRunInForeground;
 	bool mKeepConsoleOpenAfterFork;
 	static Daemon *spDaemon;
 };