mirror of
https://github.com/DNSCrypt/dnscrypt-proxy.git
synced 2025-01-14 02:25:52 +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 {
|
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
|
return time.Duration(negCacheMinTTL) * time.Second
|
||||||
}
|
}
|
||||||
ttl := uint32(maxTTL)
|
ttl := uint32(maxTTL)
|
||||||
|
@ -218,8 +218,7 @@ func (plugin *PluginCacheResponse) Description() string {
|
|||||||
|
|
||||||
func (plugin *PluginCacheResponse) Eval(pluginsState *PluginsState, msg *dns.Msg) error {
|
func (plugin *PluginCacheResponse) Eval(pluginsState *PluginsState, msg *dns.Msg) error {
|
||||||
plugin.cachedResponses = &cachedResponses
|
plugin.cachedResponses = &cachedResponses
|
||||||
|
if msg.Rcode == dns.RcodeServerFailure {
|
||||||
if msg.Rcode != dns.RcodeSuccess && msg.Rcode != dns.RcodeNXRrset {
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
cacheKey, err := computeCacheKey(pluginsState, msg)
|
cacheKey, err := computeCacheKey(pluginsState, msg)
|
||||||
|
Loading…
Reference in New Issue
Block a user