]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: Yet another clang-tidy fix 15924/head
authorRemi Gacogne <remi.gacogne@powerdns.com>
Tue, 7 Oct 2025 11:40:14 +0000 (13:40 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Tue, 7 Oct 2025 11:40:14 +0000 (13:40 +0200)
Signed-off-by: Remi Gacogne <remi.gacogne@powerdns.com>
pdns/dnsdistdist/dnsdist-backend.cc
pdns/dnsdistdist/dnsdist-lbpolicies.cc

index 701564e96fe799129846e5a30098f615267108e8..b55d2441a8f922b068635ef07ef80906fe411354 100644 (file)
@@ -460,8 +460,8 @@ void DownstreamState::handleUDPTimeout(IDState& ids)
   }
 
   if (g_rings.shouldRecordResponses()) {
-    timespec ts{};
-    gettime(&ts);
+    timespec now{};
+    gettime(&now);
 
     dnsheader fake{};
     memset(&fake, 0, sizeof(fake));
@@ -469,7 +469,7 @@ void DownstreamState::handleUDPTimeout(IDState& ids)
     uint16_t* flags = getFlagsFromDNSHeader(&fake);
     *flags = ids.internal.origFlags;
 
-    g_rings.insertResponse(ts, ids.internal.origRemote, ids.internal.qname, ids.internal.qtype, std::numeric_limits<unsigned int>::max(), 0, fake, d_config.remote, getProtocol());
+    g_rings.insertResponse(now, ids.internal.origRemote, ids.internal.qname, ids.internal.qtype, std::numeric_limits<unsigned int>::max(), 0, fake, d_config.remote, getProtocol());
   }
 
   reportTimeoutOrError();
index fc231391861131c06965cbfa2aec6d56d7d45a2f..5bb8648c3380ab68355e6874ee0142c7c91f3d9b 100644 (file)
@@ -116,7 +116,7 @@ template <class T> static std::optional<ServerPolicy::SelectedServerPosition> ge
     return std::nullopt;
   }
 
-  int randomVal = val % sum;
+  int randomVal = static_cast<int>(val % sum);
   auto selected = std::upper_bound(poss.begin(), poss.begin() + usableServers, randomVal, [](int randomVal_, const typename T::value_type& serverPair) { return  randomVal_ < serverPair.first;});
   if (selected == poss.begin() + usableServers) {
     return std::nullopt;