xfr: Transfer.Out use a new Msg every time

This commit is contained in:
StalkR 2015-01-15 11:57:52 +01:00
parent 06484909b2
commit 1d1dad9498
1 changed files with 4 additions and 6 deletions

10
xfr.go
View File

@ -160,12 +160,11 @@ func (t *Transfer) inIxfr(id uint16, c chan *Envelope) {
// The server is responsible for sending the correct sequence of RRs through the // The server is responsible for sending the correct sequence of RRs through the
// channel ch. // channel ch.
func (t *Transfer) Out(w ResponseWriter, q *Msg, ch chan *Envelope) error { func (t *Transfer) Out(w ResponseWriter, q *Msg, ch chan *Envelope) error {
r := new(Msg)
// Compress?
r.SetReply(q)
r.Authoritative = true
for x := range ch { for x := range ch {
r := new(Msg)
// Compress?
r.SetReply(q)
r.Authoritative = true
// assume it fits TODO(miek): fix // assume it fits TODO(miek): fix
r.Answer = append(r.Answer, x.RR...) r.Answer = append(r.Answer, x.RR...)
if err := w.WriteMsg(r); err != nil { if err := w.WriteMsg(r); err != nil {
@ -173,7 +172,6 @@ func (t *Transfer) Out(w ResponseWriter, q *Msg, ch chan *Envelope) error {
} }
} }
w.TsigTimersOnly(true) w.TsigTimersOnly(true)
r.Answer = nil
return nil return nil
} }