]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Make unthrottle n a var (setting not done yet)
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Tue, 19 Sep 2023 09:45:40 +0000 (11:45 +0200)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Mon, 25 Sep 2023 08:39:15 +0000 (10:39 +0200)
pdns/recursordist/syncres.cc
pdns/recursordist/syncres.hh

index 7b7f2b96fccb9021caa372dc5884d20979f341d4..2fdf209df88246e47a02174dada52715652c0f5d 100644 (file)
@@ -443,6 +443,7 @@ unsigned int SyncRes::s_packetcacheservfailttl;
 unsigned int SyncRes::s_packetcachenegativettl;
 unsigned int SyncRes::s_serverdownmaxfails;
 unsigned int SyncRes::s_serverdownthrottletime;
+unsigned int SyncRes::s_unthrottle_n = 100;
 unsigned int SyncRes::s_nonresolvingnsmaxfails;
 unsigned int SyncRes::s_nonresolvingnsthrottletime;
 unsigned int SyncRes::s_ecscachelimitttl;
@@ -1239,9 +1240,9 @@ bool SyncRes::isThrottled(time_t now, const ComboAddress& server, const DNSName&
 
 bool SyncRes::isThrottled(time_t now, const ComboAddress& server)
 {
-  // Give fully throttled servers a chance to be used, to avoid having one bad domain spoil the NS record for others
-  // If the NS answers, it will be unThrottled
-  if ((dns_random_uint32() & 0x7f) == 0) {
+  // Give fully throttled servers a chance to be used, to avoid having one bad domain spoil the NS record for others usingf the same NS
+  // If the NS answers, it will be unThrottled immediately
+  if (dns_random(s_unthrottle_n) == 0) {
     return false;
   }
   return s_throttle.lock()->shouldThrottle(now, std::tuple(server, g_rootdnsname, 0));
index 568846640186566534e02cc12e39adea77e4d839..9ae9297b873fc5bc2a726644521cc240183ad836 100644 (file)
@@ -526,6 +526,7 @@ public:
   static unsigned int s_serverdownthrottletime;
   static unsigned int s_nonresolvingnsmaxfails;
   static unsigned int s_nonresolvingnsthrottletime;
+  static unsigned int s_unthrottle_n;
 
   static unsigned int s_ecscachelimitttl;
   static uint8_t s_ecsipv4limit;