diff options
author | stickies-v <stickies-v@protonmail.com> | 2023-09-29 15:38:51 +0100 |
---|---|---|
committer | stickies-v <stickies-v@protonmail.com> | 2023-10-03 13:35:44 +0100 |
commit | 084d0372311e658a486622f720d2b827d8416591 (patch) | |
tree | 936981b94e793a4d0787e3e23dcf4f875d7646de /src/httpserver.cpp | |
parent | 41f9027813f849a9fd6a1479bbb74b9037990c3c (diff) |
http: log connection instead of request count
There is no significant benefit in logging the request count instead
of the connection count. Reduces amount of code and computational
complexity.
Diffstat (limited to 'src/httpserver.cpp')
-rw-r--r-- | src/httpserver.cpp | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/src/httpserver.cpp b/src/httpserver.cpp index 3ad329a669..995c446b58 100644 --- a/src/httpserver.cpp +++ b/src/httpserver.cpp @@ -27,7 +27,6 @@ #include <cstdlib> #include <deque> #include <memory> -#include <numeric> #include <optional> #include <string> #include <unordered_map> @@ -193,13 +192,6 @@ public: auto it{m_tracker.find(Assert(conn))}; if (it != m_tracker.end()) RemoveConnectionInternal(it); } - - size_t CountActiveRequests() const EXCLUSIVE_LOCKS_REQUIRED(!m_mutex) - { - LOCK(m_mutex); - return std::accumulate(m_tracker.begin(), m_tracker.end(), size_t(0), - [](size_t acc_count, const auto& pair) { return acc_count + pair.second; }); - } size_t CountActiveConnections() const EXCLUSIVE_LOCKS_REQUIRED(!m_mutex) { return WITH_LOCK(m_mutex, return m_tracker.size()); @@ -530,8 +522,8 @@ void StopHTTPServer() } boundSockets.clear(); { - if (g_requests.CountActiveConnections() != 0) { - LogPrint(BCLog::HTTP, "Waiting for %d requests to stop HTTP server\n", g_requests.CountActiveRequests()); + if (const auto n_connections{g_requests.CountActiveConnections()}; n_connections != 0) { + LogPrint(BCLog::HTTP, "Waiting for %d connections to stop HTTP server\n", n_connections); } g_requests.WaitUntilEmpty(); } |