]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
add d_lock while manipulating d_failedSlaveRefresh
authorKlaus Darilion <klaus.darilion@nic.at>
Wed, 1 Aug 2018 10:57:36 +0000 (10:57 +0000)
committerKlaus Darilion <klaus.darilion@nic.at>
Wed, 1 Aug 2018 10:57:36 +0000 (10:57 +0000)
pdns/slavecommunicator.cc

index ec5cfb4d02913c809da726ea80503b84d3358ae1..30316c276f16339c8810e89e30b0af0d6dbecf4e 100644 (file)
@@ -615,17 +615,20 @@ void CommunicatorClass::suck(const DNSName &domain, const ComboAddress& remote)
     }
   }
   catch(ResolverException &re) {
-    // The AXFR probably failed due to a problem on the master server. If SOA-checks against this master
-    // still succeed, we would constantly try to AXFR the zone. To avoid this, we add the zone to the list of
-    // failed slave-checks. This will suspend slave-checks (and subsequent AXFR) for this zone for some time.
-    uint64_t newCount = 1;
-    time_t now = time(0);
-    const auto failedEntry = d_failedSlaveRefresh.find(domain);
-    if (failedEntry != d_failedSlaveRefresh.end())
-      newCount = d_failedSlaveRefresh[domain].first + 1;
-    time_t nextCheck = now + std::min(newCount * d_tickinterval, (uint64_t)::arg().asNum("soa-retry-default"));
-    d_failedSlaveRefresh[domain] = {newCount, nextCheck};
-    g_log<<Logger::Error<<"Unable to AXFR zone '"<<domain<<"' from remote '"<<remote<<"' (resolver): "<<re.reason<<" (This was the "<<(newCount == 1 ? "first" : std::to_string(newCount) + "th")<<" time. Excluding zone from slave-checks until "<<nextCheck<<")"<<endl;
+    {
+      Lock l(&d_lock);
+      // The AXFR probably failed due to a problem on the master server. If SOA-checks against this master
+      // still succeed, we would constantly try to AXFR the zone. To avoid this, we add the zone to the list of
+      // failed slave-checks. This will suspend slave-checks (and subsequent AXFR) for this zone for some time.
+      uint64_t newCount = 1;
+      time_t now = time(0);
+      const auto failedEntry = d_failedSlaveRefresh.find(domain);
+      if (failedEntry != d_failedSlaveRefresh.end())
+        newCount = d_failedSlaveRefresh[domain].first + 1;
+      time_t nextCheck = now + std::min(newCount * d_tickinterval, (uint64_t)::arg().asNum("soa-retry-default"));
+      d_failedSlaveRefresh[domain] = {newCount, nextCheck};
+      g_log<<Logger::Error<<"Unable to AXFR zone '"<<domain<<"' from remote '"<<remote<<"' (resolver): "<<re.reason<<" (This was the "<<(newCount == 1 ? "first" : std::to_string(newCount) + "th")<<" time. Excluding zone from slave-checks until "<<nextCheck<<")"<<endl;
+    }
     if(di.backend && transaction) {
       g_log<<Logger::Error<<"Aborting possible open transaction for domain '"<<domain<<"' AXFR"<<endl;
       di.backend->abortTransaction();