Changeset 1285

Show
Ignore:
Timestamp:
11/15/08 23:48:38 (2 months ago)
Author:
ahu
Message:

fix meritsRecursion issue in the new packetcache code

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/pdns/pdns/common_startup.cc

    r1284 r1285  
    245245    S.ringAccount("remotes",P->getRemote()); 
    246246 
    247     if((P->d.opcode != Opcode::Notify) && P->couldBeCached() && PC.get(P,&cached)) { // short circuit - does the PacketCache recognize this question? 
     247    if((P->d.opcode != Opcode::Notify) && P->couldBeCached() && PC.get(P, &cached)) { // short circuit - does the PacketCache recognize this question? 
    248248      cached.setRemote(&P->remote);  // inlined 
    249249      cached.setSocket(P->getSocket());                               // inlined 
  • trunk/pdns/pdns/packetcache.cc

    r1284 r1285  
    6969     
    7070  bool packetMeritsRecursion=d_doRecursion && p->d.rd; 
    71  
    7271  if(ntohs(p->d.qdcount)!=1) // we get confused by packets with more than one question 
    7372    return 0; 
     
    8685 
    8786    if(getEntry(p->qdomain, p->qtype, PacketCache::PACKETCACHE, value, -1, packetMeritsRecursion)) { 
    88       //      cerr<<"Packet cache hit!"<<endl; 
     87      //      cerr<<"Packet cache hit for '"<<p->qdomain<<"', merits: "<<packetMeritsRecursion<<endl; 
    8988      (*d_statnumhit)++; 
    9089      d_hit++; 
     
    9695    } 
    9796  } 
    98   //  cerr<<"Packet cache miss"<<endl; 
     97  //  cerr<<"Packet cache miss for '"<<p->qdomain<<"', merits: "<<packetMeritsRecursion<<endl; 
    9998  (*d_statnummiss)++; 
    10099  d_miss++; 
     
    122121  bool packetMeritsRecursion=d_doRecursion && q->d.rd; 
    123122 
    124   insert(q->qdomain, q->qtype, PacketCache::PACKETCACHE, r->getString(), packetMeritsRecursion ? d_recursivettl : d_ttl, packetMeritsRecursion); 
     123  insert(q->qdomain, q->qtype, PacketCache::PACKETCACHE, r->getString(), packetMeritsRecursion ? d_recursivettl : d_ttl, -1, packetMeritsRecursion); 
    125124} 
    126125 
     
    132131   
    133132  //  cerr<<"Inserting qname '"<<qname<<"', cet: "<<(int)cet<<", value: '"<< (cet ? value : "PACKET") <<"', qtype: "<<qtype.getName()<<", ttl: "<<ttl<<endl; 
    134  
    135133  CacheEntry val; 
    136134  val.ttd=time(0)+ttl;