]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Make clang-tidy checks happy
authorOliver Chen <oliver.chen@nokia-sbell.com>
Fri, 13 Jun 2025 13:30:11 +0000 (13:30 +0000)
committerOliver Chen <oliver.chen@nokia-sbell.com>
Fri, 13 Jun 2025 13:30:11 +0000 (13:30 +0000)
pdns/dnsdistdist/dnsdist-lbpolicies.cc
pdns/dnsdistdist/dnsdist-lbpolicies.hh

index 2da5fe7675ff2f4148752bdbe4f0f4fd57fe6e16..97d51e7c5a6048643a51bcbaea4f7c417464b48e 100644 (file)
@@ -259,10 +259,10 @@ shared_ptr<DownstreamState> roundrobin(const ServerPolicy::NumberedServerVector&
   return servers.at(candidates.at((counter++) % candidates.size()) - 1).second;
 }
 
-shared_ptr<DownstreamState> orderedWrandUntag(const ServerPolicy::NumberedServerVector& servers, const DNSQuestion* dq)
+shared_ptr<DownstreamState> orderedWrandUntag(const ServerPolicy::NumberedServerVector& servers, const DNSQuestion* dnsq)
 {
   if (servers.empty()) {
-    return shared_ptr<DownstreamState>();
+    return {};
   }
 
   ServerPolicy::NumberedServerVector candidates;
@@ -272,23 +272,23 @@ shared_ptr<DownstreamState> orderedWrandUntag(const ServerPolicy::NumberedServer
   unsigned int startIndex = 0;
   unsigned int curNumber = 1;
 
-  for (auto& d : servers) {
-    if (d.second->isUp() && d.second->d_config.order <= curOrder && (!dq->ids.qTag || dq->ids.qTag->count(d.second->getNameWithAddr()) == 0)) {
-      if (d.second->d_config.order < curOrder) {
-          curOrder = d.second->d_config.order;
+  for (const auto& svr : servers) {
+    if (svr.second->isUp() && svr.second->d_config.order <= curOrder && (!dnsq->ids.qTag || dnsq->ids.qTag->count(svr.second->getNameWithAddr()) == 0)) {
+      if (svr.second->d_config.order < curOrder) {
+          curOrder = svr.second->d_config.order;
           startIndex = candidates.end() - candidates.begin();
           curNumber = 1;
       }
-      candidates.push_back(ServerPolicy::NumberedServer(curNumber++, d.second));
+      candidates.push_back(ServerPolicy::NumberedServer(curNumber++, svr.second));
     }
   }
 
   if (candidates.empty()) {
-    return shared_ptr<DownstreamState>();
+    return {};
   }
 
   ServerPolicy::NumberedServerVector selected(candidates.begin() + startIndex, candidates.end());
-  return wrandom(selected, dq);
+  return wrandom(selected, dnsq);
 }
 
 std::shared_ptr<const ServerPolicy::NumberedServerVector> getDownstreamCandidates(const std::string& poolName)
index c8770580bd364939aea62a0c5bf5294ce20c2e50..291fa754ef4c1de0b033f055b37e5e2916be2184 100644 (file)
@@ -109,7 +109,7 @@ std::shared_ptr<DownstreamState> whashedFromHash(const ServerPolicy::NumberedSer
 std::shared_ptr<DownstreamState> chashed(const ServerPolicy::NumberedServerVector& servers, const DNSQuestion* dq);
 std::shared_ptr<DownstreamState> chashedFromHash(const ServerPolicy::NumberedServerVector& servers, size_t hash);
 std::shared_ptr<DownstreamState> roundrobin(const ServerPolicy::NumberedServerVector& servers, const DNSQuestion* dq);
-std::shared_ptr<DownstreamState> orderedWrandUntag(const ServerPolicy::NumberedServerVector& servers, const DNSQuestion* dq);
+std::shared_ptr<DownstreamState> orderedWrandUntag(const ServerPolicy::NumberedServerVector& servers, const DNSQuestion* dnsq);
 
 #include <unordered_map>