From: Remi Gacogne Date: Mon, 8 Feb 2021 14:26:13 +0000 (+0100) Subject: dnsdist: Prefix the static TCP client counting vars with 's_' X-Git-Tag: dnsdist-1.6.0-alpha2~11^2~33 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bd13d7c145a119459c35e59690645d8393395927;p=thirdparty%2Fpdns.git dnsdist: Prefix the static TCP client counting vars with 's_' --- diff --git a/pdns/dnsdist-tcp.cc b/pdns/dnsdist-tcp.cc index b32b81b7c7..a17c5acf62 100644 --- a/pdns/dnsdist-tcp.cc +++ b/pdns/dnsdist-tcp.cc @@ -55,8 +55,8 @@ Let's start naively. */ -static std::mutex tcpClientsCountMutex; -static std::map tcpClientsCount; +static std::mutex s_tcpClientsCountMutex; +static std::map s_tcpClientsCount; uint64_t g_maxTCPQueuedConnections{1000}; size_t g_maxTCPQueriesPerConn{0}; @@ -147,10 +147,10 @@ const size_t DownstreamConnectionsManager::s_maxCachedConnectionsPerDownstream{2 static void decrementTCPClientCount(const ComboAddress& client) { if (g_maxTCPConnectionsPerClient) { - std::lock_guard lock(tcpClientsCountMutex); - tcpClientsCount.at(client)--; - if (tcpClientsCount[client] == 0) { - tcpClientsCount.erase(client); + std::lock_guard lock(s_tcpClientsCountMutex); + s_tcpClientsCount.at(client)--; + if (s_tcpClientsCount[client] == 0) { + s_tcpClientsCount.erase(client); } } } @@ -1080,13 +1080,13 @@ void tcpAcceptorThread(ClientState* cs) } if (g_maxTCPConnectionsPerClient) { - std::lock_guard lock(tcpClientsCountMutex); + std::lock_guard lock(s_tcpClientsCountMutex); - if (tcpClientsCount[remote] >= g_maxTCPConnectionsPerClient) { + if (s_tcpClientsCount[remote] >= g_maxTCPConnectionsPerClient) { vinfolog("Dropping TCP connection from %s because we have too many from this client already", remote.toStringWithPort()); continue; } - tcpClientsCount[remote]++; + s_tcpClientsCount[remote]++; tcpClientCountIncremented = true; }