From: Otto Date: Tue, 21 Dec 2021 15:29:30 +0000 (+0100) Subject: Update numberOfDistributedQueries only from the thread itself X-Git-Tag: auth-4.7.0-alpha1~90^2~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d99f227ace892b47bebe14c7c139da7422539168;p=thirdparty%2Fpdns.git Update numberOfDistributedQueries only from the thread itself --- diff --git a/pdns/pdns_recursor.cc b/pdns/pdns_recursor.cc index c22e43419b..f29393ce3a 100644 --- a/pdns/pdns_recursor.cc +++ b/pdns/pdns_recursor.cc @@ -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& 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());