Changeset 856

Show
Ignore:
Timestamp:
06/18/06 19:44:02 (7 years ago)
Author:
ahu
Message:

cache now prefers authoritative data, suggested and explained by Darren
Gamble

Location:
trunk/pdns/pdns
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/pdns/pdns/recursor_cache.cc

    r843 r856  
    209209  bool isNew=false; 
    210210  if(stored == d_cache.end()) { 
    211     stored=d_cache.insert(CacheEntry(key,vector<StoredRecord>())).first; 
     211    stored=d_cache.insert(CacheEntry(key,vector<StoredRecord>(), auth)).first; 
    212212    isNew=true; 
    213213  } 
     
    221221    ce.d_records.clear(); 
    222222 
    223  
     223  if(auth && !ce.d_auth) { 
     224    ce.d_records.clear(); // clear non-auth data 
     225    ce.d_auth = true; 
     226  } 
     227   
    224228  for(set<DNSResourceRecord>::const_iterator i=content.begin(); i != content.end(); ++i) { 
    225229    dr.d_ttd=i->ttl; 
  • trunk/pdns/pdns/recursor_cache.hh

    r838 r856  
    7878    string d_qname; 
    7979    uint16_t d_qtype; 
     80    bool d_auth; 
    8081 
    81     CacheEntry(const tuple<string, uint16_t>& key, const vector<StoredRecord>& records) :  
    82       d_qname(key.get<0>()), d_qtype(key.get<1>()), d_records(records) 
     82    CacheEntry(const tuple<string, uint16_t>& key, const vector<StoredRecord>& records, bool auth) :  
     83      d_qname(key.get<0>()), d_qtype(key.get<1>()), d_auth(auth), d_records(records) 
    8384    {} 
    8485