From 85ffbc535dabd93eaebcad55696647541e94637a Mon Sep 17 00:00:00 2001 From: Peter van Dijk Date: Tue, 22 Jan 2013 14:12:08 +0000 Subject: [PATCH] improve trace-regex and trace=fail behaviour git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@3072 d19b8d6e-7fed-0310-83ef-9ca221ded41b --- pdns/pdns_recursor.cc | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/pdns/pdns_recursor.cc b/pdns/pdns_recursor.cc index 3c4b7b73f..dbc29aa68 100644 --- a/pdns/pdns_recursor.cc +++ b/pdns/pdns_recursor.cc @@ -550,20 +550,25 @@ void startDoResolve(void *p) uint32_t minTTL=std::numeric_limits::max(); - string trace(sr.getTrace()); - if(!trace.empty()) { - vector lines; - boost::split(lines, trace, boost::is_any_of("\n")); - BOOST_FOREACH(const string& line, lines) { - if(!line.empty()) - L<rcode=RCode::ServFail; // no commit here, because no record g_stats.servFails++; } + + if(tracedQuery || pw.getHeader()->rcode == RCode::ServFail) + { + // log trace, if we have one + string trace(sr.getTrace()); + if(!trace.empty()) { + vector lines; + boost::split(lines, trace, boost::is_any_of("\n")); + BOOST_FOREACH(const string& line, lines) { + if(!line.empty()) + L<rcode=res; updateRcodeStats(res); -- 2.40.0