]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Tidy
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Wed, 30 Apr 2025 11:57:55 +0000 (13:57 +0200)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Thu, 4 Sep 2025 09:05:16 +0000 (11:05 +0200)
pdns/recursordist/lwres.cc
pdns/recursordist/rec-tcpout.hh
pdns/recursordist/syncres.cc

index 1e89ae84b03e7d20c105682ee4fadb3904ae45ea..5781099c1d09148e4c38b8fa4c175e89ee825263 100644 (file)
@@ -334,9 +334,9 @@ static bool tcpconnect(const OptLog& log, const ComboAddress& remote, const std:
 
   const struct timeval timeout{
     g_networkTimeoutMsec / 1000, static_cast<suseconds_t>(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<TCPIOHandler>(nsName, false, s.releaseHandle(), timeout, tlsCtx);
+  connection.d_handler = std::make_shared<TCPIOHandler>(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
index e9bf48f8e3adfc171b5a94b6414c6e811269183a..5ff80ffcecf0d2f1298ca1e74e1d21bc0e53dfff 100644 (file)
@@ -56,7 +56,7 @@ public:
   using pair_t = std::pair<ComboAddress, std::optional<ComboAddress>>;
 
   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
index 9d6119aed0710c1bf0aa8d91ce54765d86999331..38bfb0646718f5b2336c4cb085e8d26e37b56f97 100644 (file)
@@ -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