From: bert hubert Date: Sun, 28 Feb 2016 19:07:50 +0000 (+0100) Subject: improve comments in recursor_cache.cc, plus improve the disabled debug logging X-Git-Tag: rec-4.0.0-alpha2~33^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d0cd03765795230a3b797c0fa6e85c7f163e5ee3;p=thirdparty%2Fpdns.git improve comments in recursor_cache.cc, plus improve the disabled debug logging --- diff --git a/pdns/recursor_cache.cc b/pdns/recursor_cache.cc index 0b44f5a846..848bc5ddc6 100644 --- a/pdns/recursor_cache.cc +++ b/pdns/recursor_cache.cc @@ -30,6 +30,7 @@ unsigned int MemRecursorCache::bytes() return ret; } +// returns -1 for no hits int MemRecursorCache::get(time_t now, const DNSName &qname, const QType& qt, vector* res, const ComboAddress& who, vector>* signatures) { unsigned int ttd=0; @@ -61,6 +62,7 @@ int MemRecursorCache::get(time_t now, const DNSName &qname, const QType& qt, vec ) { ttd = i->d_ttd; + // cerr<<"Looking at "<d_records.size()<<" records for this name"<d_records.begin(); k != i->d_records.end(); ++k) { if(res) { DNSRecord dr; @@ -136,13 +138,13 @@ void MemRecursorCache::replace(time_t now, const DNSName &qname, const QType& qt } uint32_t maxTTD=UINT_MAX; - CacheEntry ce=*stored; + CacheEntry ce=*stored; // this is a COPY ce.d_qtype=qt.getCode(); ce.d_signatures=signatures; - // cerr<<"asked to store "<< (qname.empty() ? "EMPTY" : qname.toString()) <<"|"+qt.getName()<<" -> '"<d_content->getZoneRepresentation()<<"', auth="<toString() : "")< '"; + // cerr<<(content.empty() ? string("EMPTY CONTENT") : content.begin()->d_content->getZoneRepresentation())<<"', auth="<toString() : "none") < now) { // we still have valid data, ignore unauth data @@ -153,6 +155,8 @@ void MemRecursorCache::replace(time_t now, const DNSName &qname, const QType& qt ce.d_auth = false; // new data won't be auth } } + ce.d_records.clear(); + // limit TTL of auth->auth NSset update if needed, except for root if(ce.d_auth && auth && qt.getCode()==QType::NS && !qname.isRoot()) {