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

boxbackup-dev@fluffy.co.uk boxbackup-dev@fluffy.co.uk
Thu, 21 Aug 2008 12:06:55 +0100 (BST)


Author: chris
Date: 2008-08-21 12:06:55 +0100 (Thu, 21 Aug 2008)
New Revision: 2256

Modified:
   box/trunk/lib/server/ServerStream.h
Log:
Call virtual NotifyListenerIsReady() method when listening socket is 
ready, for Boxi thread synchronisation.


Modified: box/trunk/lib/server/ServerStream.h
===================================================================
--- box/trunk/lib/server/ServerStream.h	2008-08-21 11:06:23 UTC (rev 2255)
+++ box/trunk/lib/server/ServerStream.h	2008-08-21 11:06:55 UTC (rev 2256)
@@ -120,13 +120,19 @@
 		}
 	}
 	
+protected:
+	virtual void NotifyListenerIsReady() { }
+	
+public:
 	virtual void Run2(bool &rChildExit)
 	{
 		try
 		{
-			// Wait object with a timeout of 10 seconds, which is a reasonable time to wait before
-			// cleaning up finished child processes.
-			WaitForEvent connectionWait(10000);
+			// Wait object with a timeout of 1 second, which
+			// is a reasonable time to wait before cleaning up
+			// finished child processes, and allows the daemon
+			// to terminate reasonably quickly on request.
+			WaitForEvent connectionWait(1000);
 			
 			// BLOCK
 			{
@@ -218,6 +224,8 @@
 					}
 				}
 			}
+			
+			NotifyListenerIsReady();
 	
 			while(!StopRun())
 			{