]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
rec: make sure t_tcpClientCounts is always initialized 15261/head
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Fri, 7 Mar 2025 12:16:42 +0000 (13:16 +0100)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Fri, 7 Mar 2025 12:16:42 +0000 (13:16 +0100)
And while there make it file-local.

pdns/recursordist/rec-main.cc
pdns/recursordist/rec-main.hh
pdns/recursordist/rec-tcp.cc

index 8a607f5fb388ffedc05e2ebcb60059071f0fc4f1..bd8dc542f34892ffc08283f244a53b8818bd99e2 100644 (file)
@@ -2872,7 +2872,6 @@ static void recursorThread()
       t_proxyProtocolACL = g_initialProxyProtocolACL;
       t_proxyProtocolExceptions = g_initialProxyProtocolExceptions;
       t_udpclientsocks = std::make_unique<UDPClientSocks>();
-      t_tcpClientCounts = std::make_unique<tcpClientCounts_t>();
       if (g_proxyMapping) {
         t_proxyMapping = make_unique<ProxyMapping>(*g_proxyMapping);
       }
index 9082e0181843c7d668ad3fb72f185c875d47a86b..21e3927a83d17966aff861ebb2d95f9d0c97fba5 100644 (file)
@@ -288,9 +288,6 @@ extern boost::container::flat_set<uint16_t> g_avoidUdpSourcePorts;
 /* without reuseport, all listeners share the same sockets */
 typedef vector<pair<int, std::function<void(int, boost::any&)>>> deferredAdd_t;
 
-typedef map<ComboAddress, uint32_t, ComboAddress::addressOnlyLessThan> tcpClientCounts_t;
-extern thread_local std::unique_ptr<tcpClientCounts_t> t_tcpClientCounts;
-
 inline MT_t* getMT()
 {
   return g_multiTasker ? g_multiTasker.get() : nullptr;
index b968ab12a0c5f85481d3cf4eaeb74b1580e8b56c..d7cd3685ba6bcd70067c45330db6b5941dbf5f1b 100644 (file)
@@ -68,7 +68,8 @@ bool g_anyToTcp;
 
 uint16_t TCPConnection::s_maxInFlight;
 
-thread_local std::unique_ptr<tcpClientCounts_t> t_tcpClientCounts;
+using tcpClientCounts_t = map<ComboAddress, uint32_t, ComboAddress::addressOnlyLessThan>;
+static thread_local std::unique_ptr<tcpClientCounts_t> t_tcpClientCounts = std::make_unique<tcpClientCounts_t>();
 
 static void handleRunningTCPQuestion(int fileDesc, FDMultiplexer::funcparam_t& var);