From: Otto Moerbeek Date: Wed, 30 Apr 2025 11:57:55 +0000 (+0200) Subject: Tidy X-Git-Tag: rec-5.4.0-alpha1~279^2~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c644a55795a7f4e40cb490e82334b55898d34245;p=thirdparty%2Fpdns.git Tidy --- diff --git a/pdns/recursordist/lwres.cc b/pdns/recursordist/lwres.cc index 1e89ae84b0..5781099c1d 100644 --- a/pdns/recursordist/lwres.cc +++ b/pdns/recursordist/lwres.cc @@ -334,9 +334,9 @@ static bool tcpconnect(const OptLog& log, const ComboAddress& remote, const std: const struct timeval timeout{ g_networkTimeoutMsec / 1000, static_cast(g_networkTimeoutMsec) % 1000 * 1000}; - Socket s(remote.sin4.sin_family, SOCK_STREAM); - s.setNonBlocking(); - setTCPNoDelay(s.getHandle()); + Socket sock(remote.sin4.sin_family, SOCK_STREAM); + sock.setNonBlocking(); + setTCPNoDelay(sock.getHandle()); ComboAddress localip = localBind ? *localBind : pdns::getQueryLocalAddress(remote.sin4.sin_family, 0); if (localBind) { VLOG(log, "Connecting TCP to " << remote.toString() << " with specific local address " << localip.toString() << endl); @@ -346,7 +346,7 @@ static bool tcpconnect(const OptLog& log, const ComboAddress& remote, const std: } try { - s.bind(localip); + sock.bind(localip); } catch (const NetworkError& e) { if (localBind) { @@ -367,7 +367,7 @@ static bool tcpconnect(const OptLog& log, const ComboAddress& remote, const std: dnsOverTLS = false; } } - connection.d_handler = std::make_shared(nsName, false, s.releaseHandle(), timeout, tlsCtx); + connection.d_handler = std::make_shared(nsName, false, sock.releaseHandle(), timeout, tlsCtx); connection.d_local = localBind; // Returned state ignored // This can throw an exception, retry will need to happen at higher level diff --git a/pdns/recursordist/rec-tcpout.hh b/pdns/recursordist/rec-tcpout.hh index e9bf48f8e3..5ff80ffcec 100644 --- a/pdns/recursordist/rec-tcpout.hh +++ b/pdns/recursordist/rec-tcpout.hh @@ -56,7 +56,7 @@ public: using pair_t = std::pair>; void store(const struct timeval& now, const pair_t& pair, Connection&& connection); - Connection get(const pair_t& remoteAddress); + Connection get(const pair_t& pair); void cleanup(const struct timeval& now); [[nodiscard]] size_t size() const diff --git a/pdns/recursordist/syncres.cc b/pdns/recursordist/syncres.cc index 9d6119aed0..38bfb06467 100644 --- a/pdns/recursordist/syncres.cc +++ b/pdns/recursordist/syncres.cc @@ -5507,26 +5507,28 @@ bool SyncRes::doResolveAtThisIP(const std::string& prefix, const DNSName& qname, if (resolveret != LWResult::Result::Success) { /* Error while resolving */ - if (resolveret == LWResult::Result::Timeout) { + switch (resolveret) { + case LWResult::Result::Timeout: LOG(prefix << qname << ": Timeout resolving after " << lwr.d_usec / 1000.0 << " ms " << (doTCP ? "over TCP" : "") << endl); incTimeoutStats(remoteIP); - } - else if (resolveret == LWResult::Result::OSLimitError) { + break; + case LWResult::Result::OSLimitError: /* OS resource limit reached */ LOG(prefix << qname << ": Hit a local resource limit resolving" << (doTCP ? " over TCP" : "") << ", probable error: " << stringerror() << endl); t_Counters.at(rec::Counter::resourceLimits)++; - } - else if (resolveret == LWResult::Result::ChainLimitError) { + break; + case LWResult::Result::ChainLimitError: /* Chain resource limit reached */ LOG(prefix << qname << ": Hit a chain limit resolving" << (doTCP ? " over TCP" : "")); t_Counters.at(rec::Counter::chainLimits)++; - } - else { + break; + default: /* LWResult::Result::PermanentError */ t_Counters.at(rec::Counter::unreachables)++; d_unreachables++; // XXX questionable use of errno LOG(prefix << qname << ": Error resolving from " << remoteIP.toString() << (doTCP ? " over TCP" : "") << ", possible error: " << stringerror() << endl); + break; } // don't account for resource limits, they are our own fault