Shorten caching for empty success responses.

This commit is contained in:
Daniel
2020-11-30 15:08:25 +01:00
parent 454a234449
commit a60a53ed46
2 changed files with 6 additions and 4 deletions

View File

@@ -85,6 +85,12 @@ func (rrCache *RRCache) Clean(minExpires uint32) {
lowestTTL = maxTTL
}
// Adjust return code if there are no answers
if rrCache.RCode == dns.RcodeSuccess &&
len(rrCache.Answer) == 0 {
rrCache.RCode = dns.RcodeNameError
}
// shorten caching
switch {
case rrCache.RCode != dns.RcodeSuccess: