From: Remi Gacogne Date: Thu, 17 Feb 2022 09:31:12 +0000 (+0100) Subject: dnsdist: Fix an off-by-one second issue in the health-check interval X-Git-Tag: rec-4.7.0-alpha1~9^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7a938a603bf4e9cc14f856e1d9c98a4d5ed42214;p=thirdparty%2Fpdns.git dnsdist: Fix an off-by-one second issue in the health-check interval --- diff --git a/pdns/dnsdist.cc b/pdns/dnsdist.cc index f3c8ab0604..58f695e118 100644 --- a/pdns/dnsdist.cc +++ b/pdns/dnsdist.cc @@ -1830,7 +1830,7 @@ static void healthChecksThread() auto mplexer = std::unique_ptr(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; } diff --git a/pdns/dnsdistdist/dnsdist-healthchecks.cc b/pdns/dnsdistdist/dnsdist-healthchecks.cc index a68e1ef0ae..64efdf5341 100644 --- a/pdns/dnsdistdist/dnsdist-healthchecks.cc +++ b/pdns/dnsdistdist/dnsdist-healthchecks.cc @@ -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));