summaryrefslogtreecommitdiff
path: root/lib/server/ServerStream.h
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2006-07-27 23:18:35 +0000
committerChris Wilson <chris+github@qwirx.com>2006-07-27 23:18:35 +0000
commitc7662795f519d2b6797e4b1ac7fa4a22afa26310 (patch)
treeb1737dfa78d8e7bfb2d5a7e9831bab91869ade97 /lib/server/ServerStream.h
parenta85b710c46ec79e968da349304f30945cb9b7bc1 (diff)
* merge
- This is my current patch queue. I think that all of these are safe to apply. This is just under half of the pending changes in chris/general (the easy half).
Diffstat (limited to 'lib/server/ServerStream.h')
-rw-r--r--lib/server/ServerStream.h18
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/server/ServerStream.h b/lib/server/ServerStream.h
index 8dafccae..745c3ccb 100644
--- a/lib/server/ServerStream.h
+++ b/lib/server/ServerStream.h
@@ -56,6 +56,10 @@ public:
return "generic-stream-server";
}
+ #ifdef WIN32
+ virtual void OnIdle() { }
+ #endif
+
virtual void Run()
{
// Set process title as appropraite
@@ -215,6 +219,7 @@ public:
if(connection.get())
{
// Since this is a template parameter, the if() will be optimised out by the compiler
+ #ifndef WIN32 // no fork on Win32
if(ForkToHandleRequests)
{
pid_t pid = ::fork();
@@ -255,14 +260,20 @@ public:
}
else
{
+ #endif // !WIN32
// Just handle in this connection
SetProcessTitle("handling");
HandleConnection(*connection);
SetProcessTitle("idle");
+ #ifndef WIN32
}
+ #endif // !WIN32
}
}
-
+
+ #ifdef WIN32
+ OnIdle();
+ #else // !WIN32
// Clean up child processes (if forking daemon)
if(ForkToHandleRequests)
{
@@ -277,6 +288,7 @@ public:
}
} while(p > 0);
}
+ #endif // !WIN32
}
}
catch(...)
@@ -301,7 +313,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: