aboutsummaryrefslogtreecommitdiff
path: root/zenserver/monitoring/httpstatus.cpp
diff options
context:
space:
mode:
authorMartin Ridgers <[email protected]>2021-10-12 14:46:10 +0200
committerMartin Ridgers <[email protected]>2021-10-12 14:46:10 +0200
commit7afea60028346eaff55deaf4f4ddbd213a265e4d (patch)
treee17d8e1d1ec2a0013df10994db28929a86189568 /zenserver/monitoring/httpstatus.cpp
parentAdded "xmake project" output to .gitignore (diff)
parentRatios should not be percentages (this should be done in presentation) (diff)
downloadzen-7afea60028346eaff55deaf4f4ddbd213a265e4d.tar.xz
zen-7afea60028346eaff55deaf4f4ddbd213a265e4d.zip
Merged main
Diffstat (limited to 'zenserver/monitoring/httpstatus.cpp')
-rw-r--r--zenserver/monitoring/httpstatus.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/zenserver/monitoring/httpstatus.cpp b/zenserver/monitoring/httpstatus.cpp
index e12662b1c..8b10601dd 100644
--- a/zenserver/monitoring/httpstatus.cpp
+++ b/zenserver/monitoring/httpstatus.cpp
@@ -26,6 +26,15 @@ HttpStatusService::RegisterHandler(std::string_view Id, IHttpStatusProvider& Pro
}
void
+HttpStatusService::UnregisterHandler(std::string_view Id, IHttpStatusProvider& Provider)
+{
+ ZEN_UNUSED(Provider);
+
+ RwLock::ExclusiveLockScope _(m_Lock);
+ m_Providers.erase(std::string(Id));
+}
+
+void
HttpStatusService::HandleRequest(HttpServerRequest& Request)
{
using namespace std::literals;
@@ -36,9 +45,12 @@ HttpStatusService::HandleRequest(HttpServerRequest& Request)
{
case HttpVerb::kHead:
case HttpVerb::kGet:
- if (auto It = m_Providers.find(std::string{Key}); It != end(m_Providers))
{
- return It->second->HandleStatusRequest(Request);
+ RwLock::SharedLockScope _(m_Lock);
+ if (auto It = m_Providers.find(std::string{Key}); It != end(m_Providers))
+ {
+ return It->second->HandleStatusRequest(Request);
+ }
}
[[fallthrough]];