From dd81fb3bc4e45a63eb0e230e4a1004e988db4fc0 Mon Sep 17 00:00:00 2001 From: Chris Hofstaedtler Date: Wed, 3 Aug 2022 21:44:52 +0200 Subject: [PATCH] auth: rename N to s_udpNameserver and make static --- pdns/auth-main.cc | 16 ++++++++-------- pdns/auth-main.hh | 1 - 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/pdns/auth-main.cc b/pdns/auth-main.cc index cbb6aa973d..49ef12d5e9 100644 --- a/pdns/auth-main.cc +++ b/pdns/auth-main.cc @@ -122,10 +122,10 @@ AuthZoneCache g_zoneCache; std::unique_ptr DP{nullptr}; static std::unique_ptr dl{nullptr}; CommunicatorClass Communicator; -shared_ptr N; static double avg_latency{0.0}, receive_latency{0.0}, cache_latency{0.0}, backend_latency{0.0}, send_latency{0.0}; unique_ptr TN; static vector g_distributors; +static shared_ptr s_udpNameserver{nullptr}; static vector> g_udpReceivers; NetmaskGroup g_proxyProtocolACL; size_t g_proxyProtocolMaximumSize; @@ -519,7 +519,7 @@ static void sendout(std::unique_ptr& a, int start) backend_latency = 0.999 * backend_latency + 0.001 * std::max(diff - start, 0); start = diff; - N->send(*a); + s_udpNameserver->send(*a); diff = a->d_dt.udiff(); send_latency = 0.999 * send_latency + 0.001 * std::max(diff - start, 0); @@ -558,14 +558,14 @@ try { // If we have SO_REUSEPORT then create a new port for all receiver threads // other than the first one. - if (N->canReusePort()) { + if (s_udpNameserver->canReusePort()) { NS = g_udpReceivers[num]; if (NS == nullptr) { - NS = N; + NS = s_udpNameserver; } } else { - NS = N; + NS = s_udpNameserver; } for (;;) { @@ -1446,11 +1446,11 @@ int main(int argc, char** argv) } } - N = std::make_shared(); // this fails when we are not root, throws exception - g_udpReceivers.push_back(N); + s_udpNameserver = std::make_shared(); // this fails when we are not root, throws exception + g_udpReceivers.push_back(s_udpNameserver); size_t rthreads = ::arg().asNum("receiver-threads", 1); - if (rthreads > 1 && N->canReusePort()) { + if (rthreads > 1 && s_udpNameserver->canReusePort()) { g_udpReceivers.resize(rthreads); for (size_t idx = 1; idx < rthreads; idx++) { diff --git a/pdns/auth-main.hh b/pdns/auth-main.hh index ac2f7af8bd..47d7ecd1b6 100644 --- a/pdns/auth-main.hh +++ b/pdns/auth-main.hh @@ -42,7 +42,6 @@ extern AuthPacketCache PC; //!< This is the main PacketCache, shared across all extern AuthQueryCache QC; extern std::unique_ptr DP; extern CommunicatorClass Communicator; -extern std::shared_ptr N; extern std::unique_ptr TN; extern bool g_anyToTcp; extern bool g_8bitDNS; -- 2.47.2