mirror of
https://github.com/safing/portmaster
synced 2025-09-01 18:19:12 +00:00
Shorten caching for empty success responses.
This commit is contained in:
parent
454a234449
commit
a60a53ed46
2 changed files with 6 additions and 4 deletions
|
@ -479,10 +479,6 @@ func (mgr *tcpResolverConnMgr) handleQueryResponse(conn *dns.Conn, msg *dns.Msg)
|
|||
|
||||
// persist to database
|
||||
rrCache := inFlight.MakeCacheRecord(msg)
|
||||
if !rrCache.Cacheable() {
|
||||
return
|
||||
}
|
||||
|
||||
rrCache.Clean(minTTL)
|
||||
err := rrCache.Save()
|
||||
if err != nil {
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Add table
Reference in a new issue