[Box Backup-dev] COMMIT r902 - box/chris/merge/lib/server

boxbackup-dev at fluffy.co.uk boxbackup-dev at fluffy.co.uk
Fri Sep 1 00:02:20 BST 2006


Author: chris
Date: 2006-09-01 00:02:20 +0100 (Fri, 01 Sep 2006)
New Revision: 902

Modified:
   box/chris/merge/lib/server/ServerStream.h
Log:
(refs #3)

Added an OnIdle method which can be overridden by subclasses for idle
tasks. Used for housekeeping on Win32.

Avoid forking on Win32, and trying to clean up after children.


Modified: box/chris/merge/lib/server/ServerStream.h
===================================================================
--- box/chris/merge/lib/server/ServerStream.h	2006-08-31 22:58:30 UTC (rev 901)
+++ box/chris/merge/lib/server/ServerStream.h	2006-08-31 23:02:20 UTC (rev 902)
@@ -56,6 +56,8 @@
 		return "generic-stream-server";
 	}
 
+	virtual void OnIdle() { }
+
 	virtual void Run()
 	{
 		// Set process title as appropraite
@@ -215,7 +217,7 @@
 					if(connection.get())
 					{
 						// Since this is a template parameter, the if() will be optimised out by the compiler
-						if(ForkToHandleRequests)
+						if(WillForkToHandleRequests())
 						{
 							pid_t pid = ::fork();
 							switch(pid)
@@ -262,9 +264,11 @@
 						}
 					}
 				}
-				
+
+				OnIdle();
+
 				// Clean up child processes (if forking daemon)
-				if(ForkToHandleRequests)
+				if(WillForkToHandleRequests())
 				{
 					int status = 0;
 					int p = 0;
@@ -301,7 +305,11 @@
 	// depends on the forking model in case someone changes it later.
 	bool WillForkToHandleRequests()
 	{
+		#ifdef WIN32
+		return false;
+		#else
 		return ForkToHandleRequests;
+		#endif // WIN32
 	}
 
 private:




More information about the Boxbackup-dev mailing list