aboutsummaryrefslogtreecommitdiff
path: root/zenserver/zenserver.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'zenserver/zenserver.cpp')
-rw-r--r--zenserver/zenserver.cpp65
1 files changed, 45 insertions, 20 deletions
diff --git a/zenserver/zenserver.cpp b/zenserver/zenserver.cpp
index 6ee8d1abb..ad4d1ba84 100644
--- a/zenserver/zenserver.cpp
+++ b/zenserver/zenserver.cpp
@@ -740,35 +740,31 @@ ZenServer::InitializeStructuredCache(ZenServiceConfig& ServiceConfig)
std::move(UpstreamCache)));
}
-} // namespace zen
-
-#if ZEN_PLATFORM_WINDOWS
+////////////////////////////////////////////////////////////////////////////////
-class ZenWindowsService : public WindowsService
+class ZenEntryPoint
{
public:
- ZenWindowsService(ZenServerOptions& GlobalOptions, ZenServiceConfig& ServiceConfig)
- : m_GlobalOptions(GlobalOptions)
- , m_ServiceConfig(ServiceConfig)
- {
- }
-
- ZenWindowsService(const ZenWindowsService&) = delete;
- ZenWindowsService& operator=(const ZenWindowsService&) = delete;
-
- virtual int Run() override;
+ ZenEntryPoint(ZenServerOptions& GlobalOptions, ZenServiceConfig& ServiceConfig);
+ ZenEntryPoint(const ZenEntryPoint&) = delete;
+ ZenEntryPoint& operator = (const ZenEntryPoint&) = delete;
+ int Run();
private:
- ZenServerOptions& m_GlobalOptions;
- ZenServiceConfig& m_ServiceConfig;
- zen::LockFile m_LockFile;
+ ZenServerOptions& m_GlobalOptions;
+ ZenServiceConfig& m_ServiceConfig;
+ zen::LockFile m_LockFile;
};
-int
-ZenWindowsService::Run()
+ZenEntryPoint::ZenEntryPoint(ZenServerOptions& GlobalOptions, ZenServiceConfig& ServiceConfig)
+: m_GlobalOptions(GlobalOptions)
+, m_ServiceConfig(ServiceConfig)
{
- using namespace zen;
+}
+int
+ZenEntryPoint::Run()
+{
#if USE_SENTRY
// Initialize sentry.io client
@@ -901,6 +897,35 @@ ZenWindowsService::Run()
return 0;
}
+} // namespace zen
+
+////////////////////////////////////////////////////////////////////////////////
+
+#if ZEN_PLATFORM_WINDOWS
+
+class ZenWindowsService : public WindowsService
+{
+public:
+ ZenWindowsService(ZenServerOptions& GlobalOptions, ZenServiceConfig& ServiceConfig)
+ : m_EntryPoint(GlobalOptions, ServiceConfig)
+ {
+ }
+
+ ZenWindowsService(const ZenWindowsService&) = delete;
+ ZenWindowsService& operator=(const ZenWindowsService&) = delete;
+
+ virtual int Run() override;
+
+private:
+ ZenEntryPoint m_EntryPoint;
+};
+
+int
+ZenWindowsService::Run()
+{
+ return m_EntryPoint.Run();
+}
+
#endif // ZEN_PLATFORM_WINDOWS
////////////////////////////////////////////////////////////////////////////////