From: Remi Gacogne Date: Wed, 6 Jun 2018 14:05:20 +0000 (+0200) Subject: rec: Allow the SNMP thread to retrieve statistics X-Git-Tag: dnsdist-1.3.1~11^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=788eeb4c3318f5f6827943e4953941f48b2dc22a;p=thirdparty%2Fpdns.git rec: Allow the SNMP thread to retrieve statistics --- diff --git a/pdns/pdns_recursor.cc b/pdns/pdns_recursor.cc index 3c6a9b1890..41700632e5 100644 --- a/pdns/pdns_recursor.cc +++ b/pdns/pdns_recursor.cc @@ -101,7 +101,7 @@ typedef map tcpClientCounts_t; static thread_local std::shared_ptr t_pdl; -static thread_local int t_id; +static thread_local int t_id = -1; static thread_local std::shared_ptr t_traceRegex; static thread_local std::unique_ptr t_tcpClientCounts; #ifdef HAVE_PROTOBUF @@ -2475,18 +2475,17 @@ struct ThreadMSG void broadcastFunction(const pipefunc_t& func) { - /* This function might be called by the worker with t_id 0 during startup - for the initialization of ACLs and domain maps */ - if (t_id != s_handlerThreadID && t_id != s_distributorThreadID) { + /* This function might be called before t_id are set during startup + for the initialization of ACLs and domain maps, but the default is the same + than the handler thread */ + if (t_id != s_handlerThreadID) { g_log< >& operator+=(vector >&a, /* This function should only be called by the handler to gather metrics, wipe the cache, - reload the Lua script (not the Lua config) or change the current trace regex */ + reload the Lua script (not the Lua config) or change the current trace regex, + and by the SNMP thread to gather metrics. */ template T broadcastAccFunction(const boost::function& func) { + /* the SNMP thread uses id -1 too */ if (t_id != s_handlerThreadID) { - g_log<