]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: Fix an off-by-one second issue in the health-check interval
authorRemi Gacogne <remi.gacogne@powerdns.com>
Thu, 17 Feb 2022 09:31:12 +0000 (10:31 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Tue, 22 Feb 2022 10:32:22 +0000 (11:32 +0100)
pdns/dnsdist.cc
pdns/dnsdistdist/dnsdist-healthchecks.cc

index f3c8ab06041059248f9f6a9bc6c0f499805a8dd1..58f695e118fd319a7d480fc45a0a5c1d0653b81e 100644 (file)
@@ -1830,7 +1830,7 @@ static void healthChecksThread()
     auto mplexer = std::unique_ptr<FDMultiplexer>(FDMultiplexer::getMultiplexerSilent());
     auto states = g_dstates.getLocal(); // this points to the actual shared_ptrs!
     for(auto& dss : *states) {
-      if (dss->d_nextCheck > 0) {
+      if (dss->d_nextCheck > 1) {
         --dss->d_nextCheck;
         continue;
       }
index a68e1ef0ae7819b565d6464074f8fc219dd51154..64efdf534182e42e8efcef867753f794772613e8 100644 (file)
@@ -235,6 +235,7 @@ static void healthCheckUDPCallback(int fd, FDMultiplexer::funcparam_t& param)
       infolog("Error receiving health check response from %s: %s", data->d_ds->d_config.remote.toStringWithPort(), stringerror());
     }
     updateHealthCheckResult(data->d_ds, data->d_initial, false);
+    return;
   }
 
   /* we are using a connected socket but hey.. */
@@ -243,6 +244,7 @@ static void healthCheckUDPCallback(int fd, FDMultiplexer::funcparam_t& param)
       infolog("Invalid health check response received from %s, expecting one from %s", from.toStringWithPort(), data->d_ds->d_config.remote.toStringWithPort());
     }
     updateHealthCheckResult(data->d_ds, data->d_initial, false);
+    return;
   }
 
   updateHealthCheckResult(data->d_ds, data->d_initial, handleResponse(data));