Skip to content

Commit c0fe3a3

Browse files
committed
dnsx/cacher: clone answer to cache, do not keep the orig
1 parent 6019721 commit c0fe3a3

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

intra/dnsx/cacher.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,8 +366,8 @@ func (t *ctransport) fetch(network string, q *dns.Msg, smmout *x.DNSSummary, cb
366366
// ans may be nil
367367
cc.ans, qerr = Req(t.Transport, network, q, smm2)
368368
t.hangoverCheckpoint()
369-
// cb.put no-ops when ans is nil or xdns.Len(ans) is 0
370-
cb.put(key, cc.ans, smm2)
369+
// cb.put no-ops when ans is nil or rcode != success (0)
370+
cb.put(key, cc.ans.Copy(), smm2)
371371
return cc, qerr
372372
})
373373

@@ -541,6 +541,9 @@ func fillSummary(s *x.DNSSummary, out *x.DNSSummary) {
541541
if out == nil || s == out {
542542
return
543543
}
544+
if s == out {
545+
return
546+
}
544547

545548
// prefer out
546549

0 commit comments

Comments
 (0)