diff options
| author | Martin Ridgers <[email protected]> | 2021-10-12 14:46:10 +0200 |
|---|---|---|
| committer | Martin Ridgers <[email protected]> | 2021-10-12 14:46:10 +0200 |
| commit | 7afea60028346eaff55deaf4f4ddbd213a265e4d (patch) | |
| tree | e17d8e1d1ec2a0013df10994db28929a86189568 /zenserver/monitoring/httpstats.cpp | |
| parent | Added "xmake project" output to .gitignore (diff) | |
| parent | Ratios should not be percentages (this should be done in presentation) (diff) | |
| download | zen-7afea60028346eaff55deaf4f4ddbd213a265e4d.tar.xz zen-7afea60028346eaff55deaf4f4ddbd213a265e4d.zip | |
Merged main
Diffstat (limited to 'zenserver/monitoring/httpstats.cpp')
| -rw-r--r-- | zenserver/monitoring/httpstats.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/zenserver/monitoring/httpstats.cpp b/zenserver/monitoring/httpstats.cpp index de04294d0..4d985f8c2 100644 --- a/zenserver/monitoring/httpstats.cpp +++ b/zenserver/monitoring/httpstats.cpp @@ -26,6 +26,15 @@ HttpStatsService::RegisterHandler(std::string_view Id, IHttpStatsProvider& Provi } void +HttpStatsService::UnregisterHandler(std::string_view Id, IHttpStatsProvider& Provider) +{ + ZEN_UNUSED(Provider); + + RwLock::ExclusiveLockScope _(m_Lock); + m_Providers.erase(std::string(Id)); +} + +void HttpStatsService::HandleRequest(HttpServerRequest& Request) { using namespace std::literals; @@ -36,9 +45,12 @@ HttpStatsService::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->HandleStatsRequest(Request); + RwLock::SharedLockScope _(m_Lock); + if (auto It = m_Providers.find(std::string{Key}); It != end(m_Providers)) + { + return It->second->HandleStatsRequest(Request); + } } [[fallthrough]]; |