]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: Be consistent when accessing a backend health status 14376/head
authorRemi Gacogne <remi.gacogne@powerdns.com>
Fri, 28 Jun 2024 07:53:26 +0000 (09:53 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Fri, 28 Jun 2024 07:53:26 +0000 (09:53 +0200)
pdns/dnsdistdist/dnsdist-backend.cc

index 2f400cf55a90ded26e028635350615a897c1acbd..54c4fc76e7bae039904822a8e0b952fd3559ccf0 100644 (file)
@@ -803,7 +803,7 @@ void DownstreamState::submitHealthCheckResult(bool initial, bool newResult)
     currentCheckFailures = 0;
     consecutiveSuccessfulChecks++;
 
-    if (!upStatus) {
+    if (!upStatus.load(std::memory_order_relaxed)) {
       /* we were previously marked as "down" and had a successful health-check,
          let's see if this is enough to move to the "up" state or if we need
          more successful health-checks for that */
@@ -834,7 +834,7 @@ void DownstreamState::submitHealthCheckResult(bool initial, bool newResult)
 
     currentCheckFailures++;
 
-    if (upStatus.load()) {
+    if (upStatus.load(std::memory_order_relaxed)) {
       /* we were previously marked as "up" and failed a health-check,
          let's see if this is enough to move to the "down" state or if
          need more failed checks for that */
@@ -853,7 +853,7 @@ void DownstreamState::submitHealthCheckResult(bool initial, bool newResult)
     }
   }
 
-  if (newState != upStatus.load()) {
+  if (newState != upStatus.load(std::memory_order_relaxed)) {
     /* we are actually moving to a new state */
     if (!IsAnyAddress(d_config.remote)) {
       infolog("Marking downstream %s as '%s'", getNameWithAddr(), newState ? "up" : "down");