mirror of
https://github.com/DNSCrypt/dnscrypt-proxy.git
synced 2024-12-26 00:02:34 +01:00
Always use negative caching except on srvfail (and obviously on success)
This commit is contained in:
parent
9cd31e27f5
commit
822ae27a46
@ -42,7 +42,7 @@ func NormalizeName(name *[]byte) {
|
||||
}
|
||||
|
||||
func getMinTTL(msg *dns.Msg, minTTL uint32, maxTTL uint32, negCacheMinTTL uint32) time.Duration {
|
||||
if len(msg.Answer) <= 0 {
|
||||
if msg.Rcode != dns.RcodeSuccess || len(msg.Answer) <= 0 {
|
||||
return time.Duration(negCacheMinTTL) * time.Second
|
||||
}
|
||||
ttl := uint32(maxTTL)
|
||||
|
@ -218,8 +218,7 @@ func (plugin *PluginCacheResponse) Description() string {
|
||||
|
||||
func (plugin *PluginCacheResponse) Eval(pluginsState *PluginsState, msg *dns.Msg) error {
|
||||
plugin.cachedResponses = &cachedResponses
|
||||
|
||||
if msg.Rcode != dns.RcodeSuccess && msg.Rcode != dns.RcodeNXRrset {
|
||||
if msg.Rcode == dns.RcodeServerFailure {
|
||||
return nil
|
||||
}
|
||||
cacheKey, err := computeCacheKey(pluginsState, msg)
|
||||
|
Loading…
Reference in New Issue
Block a user