]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Update numberOfDistributedQueries only from the thread itself
authorOtto <otto.moerbeek@open-xchange.com>
Tue, 21 Dec 2021 15:29:30 +0000 (16:29 +0100)
committerOtto <otto.moerbeek@open-xchange.com>
Wed, 22 Dec 2021 10:08:50 +0000 (11:08 +0100)
pdns/pdns_recursor.cc

index c22e43419bf6f0a1c8e421df9915e47f6d206741..f29393ce3ae3ce20a804e4fba4993d64a220ff01 100644 (file)
@@ -3165,6 +3165,7 @@ static void handleNewTCPQuestion(int fd, FDMultiplexer::funcparam_t& )
 
 static string* doProcessUDPQuestion(const std::string& question, const ComboAddress& fromaddr, const ComboAddress& destaddr, ComboAddress source, ComboAddress destination, struct timeval tv, int fd, std::vector<ProxyProtocolValue>& proxyProtocolValues, RecEventTrace& eventTrace)
 {
+  ++s_threadInfos[t_id].numberOfDistributedQueries;
   gettimeofday(&g_now, nullptr);
   if (tv.tv_sec) {
     struct timeval diff = g_now - tv;
@@ -3588,7 +3589,6 @@ static void handleNewUDPQuestion(int fd, FDMultiplexer::funcparam_t& var)
             });
           }
           else {
-            ++s_threadInfos[t_id].numberOfDistributedQueries;
             doProcessUDPQuestion(data, fromaddr, dest, source, destination, tv, fd, proxyProtocolValues, eventTrace);
           }
         }
@@ -4216,8 +4216,6 @@ static bool trySendingQueryToWorker(unsigned int target, ThreadMSG* tmsg)
     }
   }
 
-  ++targetInfo.numberOfDistributedQueries;
-
   return true;
 }
 
@@ -5711,7 +5709,7 @@ static int serviceMain(int argc, char*argv[])
     /* This thread handles the web server, carbon, statistics and the control channel */
     auto& handlerInfos = s_threadInfos.at(0);
     handlerInfos.isHandler = true;
-    handlerInfos.thread = std::thread(recursorThread, 0, "main");
+    handlerInfos.thread = std::thread(recursorThread, 0, "web+stat");
 
     setCPUMap(cpusMap, currentThreadId, pthread_self());