aboutsummaryrefslogtreecommitdiff
path: root/zenserver/zenserver.cpp
diff options
context:
space:
mode:
authorMartin Ridgers <[email protected]>2021-09-15 09:22:32 +0200
committerMartin Ridgers <[email protected]>2021-09-15 09:23:33 +0200
commit8f5e773529858223beeecf5d1b69c23991df644e (patch)
tree2c360c67e028f5ecd7368212b0adf8b23578ff9d /zenserver/zenserver.cpp
parentUse zen::Sleep() in timer.cpp's tests (diff)
parentUpdated function service to new package management API (diff)
downloadzen-8f5e773529858223beeecf5d1b69c23991df644e.tar.xz
zen-8f5e773529858223beeecf5d1b69c23991df644e.zip
Merge main
Diffstat (limited to 'zenserver/zenserver.cpp')
-rw-r--r--zenserver/zenserver.cpp38
1 files changed, 24 insertions, 14 deletions
diff --git a/zenserver/zenserver.cpp b/zenserver/zenserver.cpp
index c857d4c71..c9f74daa4 100644
--- a/zenserver/zenserver.cpp
+++ b/zenserver/zenserver.cpp
@@ -2,7 +2,6 @@
#include <zencore/filesystem.h>
#include <zencore/fmtutils.h>
-#include <zencore/httpserver.h>
#include <zencore/iobuffer.h>
#include <zencore/refcount.h>
#include <zencore/scopeguard.h>
@@ -10,6 +9,7 @@
#include <zencore/thread.h>
#include <zencore/timer.h>
#include <zencore/windows.h>
+#include <zenhttp/httpserver.h>
#include <zenserverprocess.h>
#include <zenstore/cas.h>
#include <zenstore/cidstore.h>
@@ -72,6 +72,7 @@
#include "diag/diagsvcs.h"
#include "experimental/usnjournal.h"
#include "projectstore.h"
+#include "testing/httptest.h"
#include "testing/launch.h"
#include "upstream/jupiter.h"
#include "upstream/upstreamcache.h"
@@ -205,7 +206,7 @@ public:
else
{
UpstreamCache.reset();
- spdlog::info("upstream cache NOT active");
+ spdlog::info("NOT using upstream cache");
}
}
@@ -221,32 +222,40 @@ public:
{
StartMesh(BasePort);
}
+ else
+ {
+ spdlog::info("NOT starting mesh");
+ }
+
+ m_Http = zen::CreateHttpServer();
+ m_Http->Initialize(BasePort);
+ m_Http->RegisterService(m_HealthService);
+
+ m_Http->RegisterService(m_TestService); // NOTE: this is intentionally not limited to test mode as it's useful for diagnostics
+ m_Http->RegisterService(m_TestingService);
- m_Http.Initialize(BasePort);
- m_Http.AddEndpoint(m_HealthService);
- m_Http.AddEndpoint(m_TestService);
- m_Http.AddEndpoint(m_AdminService);
+ m_Http->RegisterService(m_AdminService);
if (m_HttpProjectService)
{
- m_Http.AddEndpoint(*m_HttpProjectService);
+ m_Http->RegisterService(*m_HttpProjectService);
}
- m_Http.AddEndpoint(m_CasService);
+ m_Http->RegisterService(m_CasService);
if (m_StructuredCacheService)
{
- m_Http.AddEndpoint(*m_StructuredCacheService);
+ m_Http->RegisterService(*m_StructuredCacheService);
}
if (m_HttpLaunchService)
{
- m_Http.AddEndpoint(*m_HttpLaunchService);
+ m_Http->RegisterService(*m_HttpLaunchService);
}
if (m_HttpFunctionService)
{
- m_Http.AddEndpoint(*m_HttpFunctionService);
+ m_Http->RegisterService(*m_HttpFunctionService);
}
}
@@ -284,7 +293,7 @@ public:
__debugbreak();
}
- m_Http.Run(m_TestMode);
+ m_Http->Run(m_TestMode);
spdlog::info(ZEN_APP_NAME " exiting");
@@ -296,7 +305,7 @@ public:
void RequestExit(int ExitCode)
{
RequestApplicationExit(ExitCode);
- m_Http.RequestExit();
+ m_Http->RequestExit();
}
void Cleanup() { spdlog::info(ZEN_APP_NAME " cleaning up"); }
@@ -358,13 +367,14 @@ private:
zen::ProcessHandle m_Process;
zen::NamedMutex m_ServerMutex;
- zen::HttpServer m_Http;
+ zen::Ref<zen::HttpServer> m_Http;
std::unique_ptr<zen::CasStore> m_CasStore{zen::CreateCasStore()};
std::unique_ptr<zen::CidStore> m_CidStore;
std::unique_ptr<ZenCacheStore> m_CacheStore;
zen::CasGc m_Gc{*m_CasStore};
zen::CasScrubber m_Scrubber{*m_CasStore};
HttpTestService m_TestService;
+ zen::HttpTestingService m_TestingService;
zen::HttpCasService m_CasService{*m_CasStore};
zen::RefPtr<zen::ProjectStore> m_ProjectStore;
zen::Ref<zen::LocalProjectService> m_LocalProjectService;