summaryrefslogtreecommitdiff
path: root/lib/server/ServerStream.h
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2006-08-31 23:02:20 +0000
committerChris Wilson <chris+github@qwirx.com>2006-08-31 23:02:20 +0000
commit0087222f8fe71800b0d22b0034a5f8971359e959 (patch)
tree78546d4738aa6c06ba6e19442314b0495ed88e13 /lib/server/ServerStream.h
parent7fb9db539446478122a8c3563a42699942c4d55e (diff)
(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.
Diffstat (limited to 'lib/server/ServerStream.h')
-rw-r--r--lib/server/ServerStream.h14
1 files 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: