Changeset 1265
- Timestamp:
- 10/05/08 11:49:53 (2 years ago)
- Location:
- trunk/pdns/pdns
- Files:
-
- 3 modified
-
recursor_cache.cc (modified) (2 diffs)
-
recursor_cache.hh (modified) (1 diff)
-
syncres.cc (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pdns/pdns/recursor_cache.cc
r1262 r1265 234 234 235 235 // cerr<<"time left : "<<ttd - now<<", "<< (res ? res->size() : 0) <<"\n"; 236 return ( unsignedint)ttd-now;236 return (int)ttd-now; 237 237 } 238 238 return -1; … … 363 363 } 364 364 365 bool MemRecursorCache::doAgeCache(time_t now, const string& name, uint16_t qtype, int32_t newTTL) 366 { 367 cache_t::iterator iter = d_cache.find(tie(name, qtype)); 368 if(iter == d_cache.end()) 369 return false; 370 371 int32_t ttl = iter->getTTD() - now; 372 if(ttl < 0) 373 return false; // would be dead anyhow 374 375 if(ttl > newTTL) { 376 d_cachecachevalid=false; 377 378 ttl = newTTL; 379 uint32_t newTTD = now + ttl; 380 381 CacheEntry ce = *iter; 382 for(vector<StoredRecord>::iterator j = ce.d_records.begin() ; j != ce.d_records.end(); ++j) { 383 j->d_ttd = newTTD; 384 } 385 386 d_cache.replace(iter, ce); 387 return true; 388 } 389 return false; 390 } 391 392 365 393 void MemRecursorCache::doDumpAndClose(int fd) 366 394 { -
trunk/pdns/pdns/recursor_cache.hh
r1183 r1265 40 40 void doDumpAndClose(int fd); 41 41 int doWipeCache(const string& name, uint16_t qtype=0xffff); 42 bool doAgeCache(time_t now, const string& name, uint16_t qtype, int32_t newTTL); 42 43 uint64_t cacheHits, cacheMisses; 43 44 bool d_followRFC2181; -
trunk/pdns/pdns/syncres.cc
r1230 r1265 608 608 LOG<<prefix<<qname<<": Failed to resolve via any of the "<<(unsigned int)rnameservers.size()<<" offered NS at level '"<<auth<<"'"<<endl; 609 609 if(auth!="." && flawedNSSet) { 610 g_stats.nsSetInvalidations++;611 LOG<<prefix<<qname<<": Invalidating nameservers for level '"<<auth<<"', next query might succeed"<<endl;612 RC.doWipeCache(auth, QType::NS);610 LOG<<prefix<<qname<<": Ageing nameservers for level '"<<auth<<"', next query might succeed"<<endl; 611 if(RC.doAgeCache(d_now.tv_sec, auth, QType::NS, 10)) 612 g_stats.nsSetInvalidations++; 613 613 } 614 614 return -1;