Deep copy cached responses
This commit is contained in:
parent
3a5585f8a1
commit
f9ec0a9c09
|
@ -79,20 +79,20 @@ func (plugin *PluginCache) Eval(pluginsState *PluginsState, msg *dns.Msg) error
|
||||||
}
|
}
|
||||||
cached := cachedAny.(CachedResponse)
|
cached := cachedAny.(CachedResponse)
|
||||||
|
|
||||||
synth := cached.msg
|
synth := cached.msg.Copy()
|
||||||
synth.Id = msg.Id
|
synth.Id = msg.Id
|
||||||
synth.Response = true
|
synth.Response = true
|
||||||
synth.Compress = true
|
synth.Compress = true
|
||||||
synth.Question = msg.Question
|
synth.Question = msg.Question
|
||||||
|
|
||||||
if time.Now().After(cached.expiration) {
|
if time.Now().After(cached.expiration) {
|
||||||
pluginsState.sessionData["stale"] = &synth
|
pluginsState.sessionData["stale"] = synth
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
updateTTL(&cached.msg, cached.expiration)
|
updateTTL(&cached.msg, cached.expiration)
|
||||||
|
|
||||||
pluginsState.synthResponse = &synth
|
pluginsState.synthResponse = synth
|
||||||
pluginsState.action = PluginsActionSynth
|
pluginsState.action = PluginsActionSynth
|
||||||
pluginsState.cacheHit = true
|
pluginsState.cacheHit = true
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in New Issue