Type.extra (#1538)

* Revert "pkg/typify: empty messages are OtherError (#1531)"

This reverts commit fc1d73ffa9.

* plugin/cache: add failsafeTTL

If we can not see what TTL we should put on a message to be cached, use
5 seconds as minimal TTL. We used to apply the maximum TTL to these
  messages.
This commit is contained in:
Miek Gieben
2018-02-17 19:45:52 +01:00
committed by GitHub
parent 9719a47c1b
commit 8cce06cba1
5 changed files with 9 additions and 37 deletions

View File

@@ -95,6 +95,11 @@ func minMsgTTL(m *dns.Msg, mt response.Type) time.Duration {
return 0
}
// No data to examine, return a short ttl as a fail safe.
if len(m.Answer)+len(m.Ns) == 0 {
return failSafeTTL
}
minTTL := maxTTL
for _, r := range append(m.Answer, m.Ns...) {
switch mt {