mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-02 14:37:42 -03:00
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.
Github-Pull: #28551
Rebased-From: 084d037231
This commit is contained in:
parent
ae86adabe4
commit
752a456fa8
1 changed files with 2 additions and 10 deletions
|
@ -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());
|
||||
|
@ -534,8 +526,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();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue