mirror of
https://github.com/safing/portmaster
synced 2025-09-02 10:39:22 +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
|
// persist to database
|
||||||
rrCache := inFlight.MakeCacheRecord(msg)
|
rrCache := inFlight.MakeCacheRecord(msg)
|
||||||
if !rrCache.Cacheable() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
rrCache.Clean(minTTL)
|
rrCache.Clean(minTTL)
|
||||||
err := rrCache.Save()
|
err := rrCache.Save()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -85,6 +85,12 @@ func (rrCache *RRCache) Clean(minExpires uint32) {
|
||||||
lowestTTL = maxTTL
|
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
|
// shorten caching
|
||||||
switch {
|
switch {
|
||||||
case rrCache.RCode != dns.RcodeSuccess:
|
case rrCache.RCode != dns.RcodeSuccess:
|
||||||
|
|
Loading…
Add table
Reference in a new issue