From: Mark Zealey Date: Fri, 13 Dec 2013 20:39:47 +0000 (+0200) Subject: On testing with large numbers of unknown domains the send-root-referral X-Git-Tag: rec-3.6.0-rc1~285^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3194f0df52dfd0aecd0b5a9bfd502cfb189a3605;p=pdns On testing with large numbers of unknown domains the send-root-referral argument query amounted to quite a high proportion of CPU time. This will cache it to reduce this overhead as is already done with a number of variables. --- diff --git a/pdns/packethandler.cc b/pdns/packethandler.cc index e43802403..22d6ff911 100644 --- a/pdns/packethandler.cc +++ b/pdns/packethandler.cc @@ -52,6 +52,12 @@ AtomicCounter PacketHandler::s_count; extern string s_programname; +enum root_referral { + NO_ROOT_REFERRAL, + LEAN_ROOT_REFERRAL, + FULL_ROOT_REFERRAL +}; + PacketHandler::PacketHandler():B(s_programname) { ++s_count; @@ -59,6 +65,9 @@ PacketHandler::PacketHandler():B(s_programname) d_doRecursion= ::arg().mustDo("recursor"); d_logDNSDetails= ::arg().mustDo("log-dns-details"); d_doIPv6AdditionalProcessing = ::arg().mustDo("do-ipv6-additional-processing"); + d_sendRootReferral = ::arg().mustDo("send-root-referral") + ? ( pdns_iequals(::arg()["send-root-referral"], "lean") ? LEAN_ROOT_REFERRAL : FULL_ROOT_REFERRAL ) + : NO_ROOT_REFERRAL; string fname= ::arg()["lua-prequery-script"]; if(fname.empty()) { @@ -102,7 +111,7 @@ void PacketHandler::addRootReferral(DNSPacket* r) r->addRecord(rr); } - if(pdns_iequals(::arg()["send-root-referral"], "lean")) + if( d_sendRootReferral == LEAN_ROOT_REFERRAL ) return; // add the additional stuff @@ -1242,7 +1251,7 @@ DNSPacket *PacketHandler::questionOrRecurse(DNSPacket *p, bool *shouldRecurse) if(!retargetcount) r->setA(false); // drop AA if we never had a SOA in the first place - if(::arg().mustDo("send-root-referral")) { + if( d_sendRootReferral != NO_ROOT_REFERRAL ) { DLOG(L<