]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Review comments: document what happens on failure and use runOnce() as a building...
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Tue, 12 Apr 2022 10:25:17 +0000 (12:25 +0200)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Tue, 12 Apr 2022 11:39:43 +0000 (13:39 +0200)
pdns/recursordist/docs/settings.rst
pdns/recursordist/rec-taskqueue.cc
pdns/recursordist/rec-taskqueue.hh
pdns/recursordist/taskqueue.hh

index 7773ac9b84134efe88f13f4a9e84af001ccc720c..802b17327f57edc690add76e2ea9a898e0fc0de1 100644 (file)
@@ -1079,12 +1079,14 @@ Limit the maximum number of simultaneous DoT probes the Recursor will schedule.
 The default value 0 means no DoT probes are scheduled.
 
 DoT probes are used to check if an authoritative server's IP address supports DoT.
-If the probe determines an IP address supports DoT, the Recursor will use DoT to contact it for subsequent queries.
+If the probe determines an IP address supports DoT, the Recursor will use DoT to contact it for subsequent queries until a failure occurs.
+After a failure, the Recursor will stop using DoT for that specific IP address for a while.
 The results of probes are remembered and can be viewed by the ``rec_control dump-dot-probe-map`` command.
 If the maximum number of pending probes is reached, no probes will be scheduled, even if no DoT status is known for an address.
 If the result of a probe is not yet available, the Recursor will contact the authoritative server in the regular way, unless an authoritative server is configured to be contacted over DoT always using :ref:`setting-dot-to-auth-names`.
 In that case no probe will be scheduled.
 
+
 Note::
   DoT probing is an experimental feature.
   Please test thoroughly if it is suitable in your specific production environment before enabling.
index a4ba8f88aefb78847f8e52b39cbda5d438d41a2f..98b5f6296d92f381c34014fdb3f12bf8dda0ff7e 100644 (file)
@@ -207,28 +207,20 @@ static void tryDoT(const struct timeval& now, bool logErrors, const pdns::Resolv
 void runTasks(size_t max, bool logErrors)
 {
   for (size_t count = 0; count < max; count++) {
-    pdns::ResolveTask task;
-    {
-      auto lock = s_taskQueue.lock();
-      if (lock->queue.empty()) {
-        return;
-      }
-      task = lock->queue.pop();
-    }
-    bool expired = task.run(logErrors);
-    if (expired) {
-      s_taskQueue.lock()->queue.incExpired();
+    if (!runTaskOnce(logErrors)) {
+      // No more tasks in queue
+      break;
     }
   }
 }
 
-void runTaskOnce(bool logErrors)
+bool runTaskOnce(bool logErrors)
 {
   pdns::ResolveTask task;
   {
     auto lock = s_taskQueue.lock();
     if (lock->queue.empty()) {
-      return;
+      return false;
     }
     task = lock->queue.pop();
   }
@@ -236,6 +228,7 @@ void runTaskOnce(bool logErrors)
   if (expired) {
     s_taskQueue.lock()->queue.incExpired();
   }
+  return true;
 }
 
 void pushAlmostExpiredTask(const DNSName& qname, uint16_t qtype, time_t deadline)
index cb9e71bf85a68548663481b73dea8548bd4dfc62..868b33e0af886be097d5f42390ec28eeb19bdc9a 100644 (file)
@@ -32,7 +32,7 @@ namespace pdns
 struct ResolveTask;
 }
 void runTasks(size_t max, bool logErrors);
-void runTaskOnce(bool logErrors);
+bool runTaskOnce(bool logErrors);
 void pushAlmostExpiredTask(const DNSName& qname, uint16_t qtype, time_t deadline);
 void pushResolveTask(const DNSName& qname, uint16_t qtype, time_t now, time_t deadline);
 bool pushTryDoTTask(const DNSName& qname, uint16_t qtype, const ComboAddress& ip, time_t deadline, const DNSName& nsname);
index 92e3f176d12b3e4000ec9aeb1f160c0bc22489a9..40df635dfd788b12944a0bbb56e76ee5c37016f6 100644 (file)
@@ -50,7 +50,7 @@ struct ResolveTask
 {
   DNSName d_qname;
   uint16_t d_qtype;
-  // Deadline is not part of index and <
+  // Deadline is not part of index and not used by operator<()
   time_t d_deadline;
   // Whether to run this task in regular mode (false) or in the mode that refreshes almost expired tasks
   bool d_refreshMode;
@@ -59,7 +59,7 @@ struct ResolveTask
   TaskFunction d_func;
   // IP used by DoT probe tasks
   ComboAddress d_ip;
-  // NS name used by DoT probe task
+  // NS name used by DoT probe task, not part of index and not used by operator<()
   DNSName d_nsname;
 
   bool operator<(const ResolveTask& a) const