From 239c8386302e1c93bd39865eb9f882592d54790f Mon Sep 17 00:00:00 2001 From: Otto Moerbeek Date: Tue, 18 Jun 2019 11:22:25 +0200 Subject: [PATCH] Comments from pieterlexis: comment args, restructure "no ancestor found" case, zap newlines in trace. --- pdns/syncres.cc | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/pdns/syncres.cc b/pdns/syncres.cc index b7334e4fca..901c7bcd16 100644 --- a/pdns/syncres.cc +++ b/pdns/syncres.cc @@ -597,15 +597,15 @@ int SyncRes::doResolve(const DNSName &qname, const QType &qtype, vector beenthereIgnored; getBestNSFromCache(qname, qtype, bestns, &flawedNSSet, depth + 1, beenthereIgnored); } - DNSName ancestor; - if (bestns.size() > 0) { - ancestor = bestns[0].d_name; - QLOG("Step1 Ancestor from cache is " << ancestor.toString()); - } else { + + if (bestns.size() == 0) { + // Something terrible is wrong QLOG("Step1 No ancestor found return ServFail"); return RCode::ServFail; } + const DNSName& ancestor(bestns[0].d_name); + QLOG("Step1 Ancestor from cache is " << ancestor.toString()); child = ancestor; unsigned int targetlen = std::min(child.countLabels() + (i > 3 ? 3 : 1), qnamelen); @@ -624,7 +624,7 @@ int SyncRes::doResolve(const DNSName &qname, const QType &qtype, vector&ret, unsigned int depth, set& beenthere, vState& state, bool *fromCache, StopAtDelegation *stopAtDelegation) -- 2.47.2