From 0087222f8fe71800b0d22b0034a5f8971359e959 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Thu, 31 Aug 2006 23:02:20 +0000 Subject: (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. --- lib/server/ServerStream.h | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/server/ServerStream.h b/lib/server/ServerStream.h index 8dafccae..67890d83 100644 --- a/lib/server/ServerStream.h +++ b/lib/server/ServerStream.h @@ -56,6 +56,8 @@ public: return "generic-stream-server"; } + virtual void OnIdle() { } + virtual void Run() { // Set process title as appropraite @@ -215,7 +217,7 @@ public: 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 @@ public: } } } - + + OnIdle(); + // Clean up child processes (if forking daemon) - if(ForkToHandleRequests) + if(WillForkToHandleRequests()) { int status = 0; int p = 0; @@ -301,7 +305,11 @@ protected: // depends on the forking model in case someone changes it later. bool WillForkToHandleRequests() { + #ifdef WIN32 + return false; + #else return ForkToHandleRequests; + #endif // WIN32 } private: -- cgit v1.2.3