truncated cache fix (#485)

This commit is contained in:
Dmytro Kislov 2017-01-22 20:32:08 +00:00 committed by Miek Gieben
parent a1215974ee
commit c68dc7c1aa

View file

@ -25,9 +25,9 @@ func (c *Cache) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg)
do := state.Do() // TODO(): might need more from OPT record? Like the actual bufsize?
if i, ok, expired := c.get(qname, qtype, do); ok && !expired {
resp := i.toMsg(r)
state.SizeAndDo(resp)
resp, _ = state.Scrub(resp)
w.WriteMsg(resp)
return dns.RcodeSuccess, nil