[Box Backup-commit] COMMIT r1094 - box/chris/merge/lib/server

boxbackup-dev at fluffy.co.uk boxbackup-dev at fluffy.co.uk
Wed Oct 18 20:44:20 BST 2006


Author: chris
Date: 2006-10-18 20:44:20 +0100 (Wed, 18 Oct 2006)
New Revision: 1094

Modified:
   box/chris/merge/lib/server/ServerStream.h
Log:
Reinstate ifdefs around code that should be disabled on Win32 (fake fork()
seems to be a bad idea).

Comment spelling fixes. (refs #3)


Modified: box/chris/merge/lib/server/ServerStream.h
===================================================================
--- box/chris/merge/lib/server/ServerStream.h	2006-10-18 19:41:33 UTC (rev 1093)
+++ box/chris/merge/lib/server/ServerStream.h	2006-10-18 19:44:20 UTC (rev 1094)
@@ -60,7 +60,7 @@
 
 	virtual void Run()
 	{
-		// Set process title as appropraite
+		// Set process title as appropriate
 		SetProcessTitle(ForkToHandleRequests?"server":"idle");
 	
 		// Handle exceptions and child task quitting gracefully.
@@ -217,7 +217,8 @@
 					if(connection.get())
 					{
 						// Since this is a template parameter, the if() will be optimised out by the compiler
-						if(WillForkToHandleRequests())
+						#ifndef WIN32 // no fork on Win32
+						if(ForkToHandleRequests)
 						{
 							pid_t pid = ::fork();
 							switch(pid)
@@ -257,18 +258,22 @@
 						}
 						else
 						{
+						#endif // !WIN32
 							// Just handle in this connection
 							SetProcessTitle("handling");
 							HandleConnection(*connection);
 							SetProcessTitle("idle");										
+						#ifndef WIN32
 						}
+						#endif // !WIN32
 					}
 				}
 
 				OnIdle();
 
+				#ifndef WIN32
 				// Clean up child processes (if forking daemon)
-				if(WillForkToHandleRequests())
+				if(ForkToHandleRequests)
 				{
 					int status = 0;
 					int p = 0;
@@ -281,6 +286,7 @@
 						}
 					} while(p > 0);
 				}
+				#endif // !WIN32
 			}
 		}
 		catch(...)
@@ -301,7 +307,7 @@
 	virtual void Connection(StreamType &rStream) = 0;
 	
 protected:
-	// For checking code in dervied classes -- use if you have an algorithm which
+	// For checking code in derived classes -- use if you have an algorithm which
 	// depends on the forking model in case someone changes it later.
 	bool WillForkToHandleRequests()
 	{




More information about the Boxbackup-commit mailing list