[Box Backup-commit] COMMIT r993 - box/trunk/lib/server

boxbackup-dev at fluffy.co.uk boxbackup-dev at fluffy.co.uk
Thu Oct 12 23:15:09 BST 2006


Author: chris
Date: 2006-10-12 23:15:09 +0100 (Thu, 12 Oct 2006)
New Revision: 993

Modified:
   box/trunk/lib/server/ServerStream.h
Log:
 * 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/trunk/lib/server/ServerStream.h
===================================================================
--- box/trunk/lib/server/ServerStream.h	2006-10-12 22:14:42 UTC (rev 992)
+++ box/trunk/lib/server/ServerStream.h	2006-10-12 22:15:09 UTC (rev 993)
@@ -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-commit mailing list