From 598b7bd0699b46b91a2e445338f389a14d4773e8 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Wed, 18 Oct 2006 19:44:20 +0000 Subject: Reinstate ifdefs around code that should be disabled on Win32 (fake fork() seems to be a bad idea). Comment spelling fixes. (refs #3) --- lib/server/ServerStream.h | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'lib/server/ServerStream.h') diff --git a/lib/server/ServerStream.h b/lib/server/ServerStream.h index 67890d83..49479039 100644 --- a/lib/server/ServerStream.h +++ b/lib/server/ServerStream.h @@ -60,7 +60,7 @@ public: 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 @@ public: 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 @@ public: } 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 @@ public: } } while(p > 0); } + #endif // !WIN32 } } catch(...) @@ -301,7 +307,7 @@ public: 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() { -- cgit v1.2.3