From: Bert Hubert Date: Mon, 13 Jan 2003 22:36:34 +0000 (+0000) Subject: more work X-Git-Tag: pdns-2.9.5~16 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c6644fc5113a4992f62dbd8dcfa97050c1134701;p=pdns more work git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@129 d19b8d6e-7fed-0310-83ef-9ca221ded41b --- diff --git a/pdns/pdns_recursor.cc b/pdns/pdns_recursor.cc index bee6b9469..da8840dfa 100644 --- a/pdns/pdns_recursor.cc +++ b/pdns/pdns_recursor.cc @@ -17,7 +17,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include #include #include @@ -100,14 +99,17 @@ int arecvfrom(char *data, int len, int flags, struct sockaddr *toaddr, socklen_t typedef map > cache_t; cache_t cache; +int cacheHits, cacheMisses; int getCache(const string &qname, const QType& qt, set* res) { cache_t::const_iterator j=cache.find(toLower(qname)+"|"+qt.getName()); if(j!=cache.end() && j->first==toLower(qname)+"|"+qt.getName() && j->second.begin()->ttl>(unsigned int)time(0)) { if(res) *res=j->second; + cacheHits++; return (unsigned int)j->second.begin()->ttl-time(0); } + cacheMisses++; return -1; } @@ -295,6 +297,7 @@ int main(int argc, char **argv) PacketID pident; init(); + int counter=0; for(;;) { while(MT.schedule()); // housekeeping, let threads do their thing @@ -360,6 +363,9 @@ int main(int argc, char **argv) else { cout<<"new question arrived for '"<string SyncRes::getBestNSNamesFromCache( templatebool SyncRes::doCNAMECacheCheck(const string &qname, const QType &qtype, vector&ret, int depth, int &res) { + if(depth>10) { + cout<int SyncRes::doResolveAt(set nam cout<d_place==DNSResourceRecord::AUTHORITY && endsOn(qname,i->qname) && i->qtype.getCode()==QType::SOA) { @@ -332,10 +338,8 @@ templateint SyncRes::doResolveAt(set nam negindic=true; } else if(i->d_place==DNSResourceRecord::ANSWER && i->qname==qname && i->qtype.getCode()==QType::CNAME && (!(qtype==QType(QType::CNAME)))) { - cout<content<beenthere2; - return doResolve(i->content, qtype, ret,0,beenthere2); + newtarget=i->content; } // for ANY answers we *must* have an authoritive answer else if(i->d_place==DNSResourceRecord::ANSWER && i->qname==qname && (i->qtype==qtype || ( qtype==QType(QType::ANY) && aabit))) { @@ -367,6 +371,11 @@ templateint SyncRes::doResolveAt(set nam cout<beenthere2; + return doResolve(newtarget, qtype, ret,0,beenthere2); + } else if(realreferral) { cout<