| | 231 | bool MemRecursorCache::attemptToRefreshNSTTL(const QType& qt, const set<DNSResourceRecord>& content, const CacheEntry& stored) |
|---|
| | 232 | { |
|---|
| | 233 | if(!stored.d_auth) { |
|---|
| | 234 | // cerr<<"feel free to scribble non-auth data!"<<endl; |
|---|
| | 235 | return false; |
|---|
| | 236 | } |
|---|
| | 237 | |
|---|
| | 238 | if(qt.getCode()!=QType::NS) { |
|---|
| | 239 | // cerr<<"Not NS record"<<endl; |
|---|
| | 240 | return false; |
|---|
| | 241 | } |
|---|
| | 242 | if(content.size()!=stored.d_records.size()) { |
|---|
| | 243 | // cerr<<"Not equal number of records"<<endl; |
|---|
| | 244 | return false; |
|---|
| | 245 | } |
|---|
| | 246 | if(stored.d_records.empty()) |
|---|
| | 247 | return false; |
|---|
| | 248 | |
|---|
| | 249 | if(stored.d_records.begin()->d_ttd > content.begin()->ttl) { |
|---|
| | 250 | // cerr<<"attempt to LOWER TTL - fine by us"<<endl; |
|---|
| | 251 | return false; |
|---|
| | 252 | } |
|---|
| | 253 | |
|---|
| | 254 | |
|---|
| | 255 | // cerr<<"Returning true - update attempt!\n"; |
|---|
| | 256 | return true; |
|---|
| | 257 | } |
|---|
| | 258 | |
|---|