]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Rename authWaitTime() to make it explicit we're talking milliseconds
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Fri, 24 Nov 2023 10:34:15 +0000 (11:34 +0100)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Wed, 22 May 2024 12:07:22 +0000 (14:07 +0200)
pdns/recursordist/pdns_recursor.cc
pdns/recursordist/rec-main.hh
pdns/recursordist/rec-tcp.cc

index 921d429a314acceb69828f2c71b9687358d149ab..da94b29fa96d234870e8482cfe809e1cf6103775 100644 (file)
@@ -251,7 +251,7 @@ PacketBuffer GenUDPQueryResponse(const ComboAddress& dest, const string& query)
   t_fdm->addReadFD(socket.getHandle(), handleGenUDPQueryResponse, pident);
 
   PacketBuffer data;
-  int ret = g_multiTasker->waitEvent(pident, &data, authWaitTime(g_multiTasker));
+  int ret = g_multiTasker->waitEvent(pident, &data, authWaitTimeMSec(g_multiTasker));
 
   if (ret == 0 || ret == -1) { // timeout
     t_fdm->removeReadFD(socket.getHandle());
@@ -269,7 +269,7 @@ thread_local std::unique_ptr<UDPClientSocks> t_udpclientsocks;
 
 // If we have plenty of mthreads slot left, use default timeout.
 // Othwerwise reduce the timeout to be between g_networkTimeoutMsec/10 and g_networkTimeoutMsec
-unsigned int authWaitTime(const std::unique_ptr<MT_t>& mtasker)
+unsigned int authWaitTimeMSec(const std::unique_ptr<MT_t>& mtasker)
 {
   const auto max = g_maxMThreads;
   const auto current = mtasker->numProcesses();
@@ -308,12 +308,12 @@ LWResult::Result asendto(const void* data, size_t len, int /* flags */,
         *fileDesc = -1; // gets used in waitEvent / sendEvent later on
         auto currentChainSize = chain.first->key->authReqChain.size();
         if (g_maxChainLength > 0 && currentChainSize >= g_maxChainLength) {
-          return  LWResult::Result::OSLimitError;
+          return LWResult::Result::OSLimitError;
         }
-        assert(uSec(chain.first->key->creationTime) != 0);
+        assert(uSec(chain.first->key->creationTime) != 0); // NOLINT
         auto age = now - chain.first->key->creationTime;
-        if (uSec(age) > static_cast<uint64_t>(1000) * authWaitTime(g_multiTasker) * 2 / 3) {
-          return  LWResult::Result::OSLimitError;
+        if (uSec(age) > static_cast<uint64_t>(1000) * authWaitTimeMSec(g_multiTasker) * 2 / 3) {
+          return LWResult::Result::OSLimitError;
         }
         chain.first->key->authReqChain.insert(qid); // we can chain
         auto maxLength = t_Counters.at(rec::Counter::maxChainLength);
@@ -360,7 +360,7 @@ LWResult::Result arecvfrom(PacketBuffer& packet, int /* flags */, const ComboAdd
   pident->remote = fromAddr;
   pident->creationTime = now;
 
-  int ret = g_multiTasker->waitEvent(pident, &packet, authWaitTime(g_multiTasker), &now);
+  int ret = g_multiTasker->waitEvent(pident, &packet, authWaitTimeMSec(g_multiTasker), &now);
   len = 0;
 
   /* -1 means error, 0 means timeout, 1 means a result from handleUDPServerResponse() which might still be an error */
@@ -513,7 +513,7 @@ public:
   }
 
 private:
-  std::unique_ptr<DNSComboWriter>& d_dc;
+  std::unique_ptr<DNSComboWriter>& d_dc; // NOLINT(cppcoreguidelines-avoid-const-or-ref-data-members)
   bool d_handled{false};
 };
 
index 7bec94eb39a3dfdc011c51ceaa8e09477513d3ab..c69e4de74a199d780584fba52c71cae5b187b346 100644 (file)
@@ -624,7 +624,7 @@ string doTraceRegex(FDWrapper file, vector<string>::const_iterator begin, vector
 extern bool g_luaSettingsInYAML;
 void startLuaConfigDelayedThreads(const vector<RPZTrackerParams>& rpzs, uint64_t generation);
 void activateLuaConfig(LuaConfigItems& lci);
-unsigned int authWaitTime(const std::unique_ptr<MT_t>& mtasker);
+unsigned int authWaitTimeMSec(const std::unique_ptr<MT_t>& mtasker);
 
 #define LOCAL_NETS "127.0.0.0/8, 10.0.0.0/8, 100.64.0.0/10, 169.254.0.0/16, 192.168.0.0/16, 172.16.0.0/12, ::1/128, fc00::/7, fe80::/10"
 #define LOCAL_NETS_INVERSE "!127.0.0.0/8, !10.0.0.0/8, !100.64.0.0/10, !169.254.0.0/16, !192.168.0.0/16, !172.16.0.0/12, !::1/128, !fc00::/7, !fe80::/10"
index d391df532215be3662f7ee8d3bbc97d1c412cbea..4d1a055fff6f3ec54caf309c2149ef2e5e4787b8 100644 (file)
@@ -1060,7 +1060,7 @@ LWResult::Result arecvtcp(PacketBuffer& data, const size_t len, shared_ptr<TCPIO
   // Will set pident->lowState
   TCPIOHandlerStateChange(IOState::Done, state, pident);
 
-  int ret = g_multiTasker->waitEvent(pident, &data, authWaitTime(g_multiTasker));
+  int ret = g_multiTasker->waitEvent(pident, &data, authWaitTimeMSec(g_multiTasker));
   TCPLOG(pident->tcpsock, "arecvtcp " << ret << ' ' << data.size() << ' ');
   if (ret == 0) {
     TCPLOG(pident->tcpsock, "timeout" << endl);