]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: Scan the UDP buckets only when we have outstanding queries 11577/head
authorRemi Gacogne <remi.gacogne@powerdns.com>
Tue, 26 Apr 2022 07:50:50 +0000 (09:50 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Tue, 26 Apr 2022 07:50:50 +0000 (09:50 +0200)
pdns/dnsdistdist/dnsdist-backend.cc

index 25dd110345f0a2384cd595e59e603f1c8a5d890b..ac655111fab141e2b6c815d52197b1879ba13f16 100644 (file)
@@ -357,16 +357,18 @@ void DownstreamState::handleTimeouts()
     }
   }
   else {
-    for (IDState& ids : idStates) {
-      int64_t usageIndicator = ids.usageIndicator;
-      if (IDState::isInUse(usageIndicator) && isIDSExpired(ids)) {
-        if (!ids.tryMarkUnused(usageIndicator)) {
-          /* this state has been altered in the meantime,
-             don't go anywhere near it */
-          continue;
-        }
+    if (outstanding.load() > 0) {
+      for (IDState& ids : idStates) {
+        int64_t usageIndicator = ids.usageIndicator;
+        if (IDState::isInUse(usageIndicator) && isIDSExpired(ids)) {
+          if (!ids.tryMarkUnused(usageIndicator)) {
+            /* this state has been altered in the meantime,
+               don't go anywhere near it */
+            continue;
+          }
 
-        handleTimeout(ids);
+          handleTimeout(ids);
+        }
       }
     }
   }