Skip to content

Commit

Permalink
Fix closing order
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Scheuermann committed Nov 13, 2023
1 parent 5d3f81b commit cc506bc
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions xfr.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,10 @@ func (t *Transfer) In(q *Msg, a string) (env chan *Envelope, err error) {

func (t *Transfer) inAxfr(q *Msg, c chan *Envelope) {
first := true
defer t.Close()
defer close(c)
defer func() {
t.Close()
close(c)
}()
timeout := dnsTimeout
if t.ReadTimeout != 0 {
timeout = t.ReadTimeout
Expand Down Expand Up @@ -131,8 +133,10 @@ func (t *Transfer) inIxfr(q *Msg, c chan *Envelope) {
axfr := true
n := 0
qser := q.Ns[0].(*SOA).Serial
defer t.Close()
defer close(c)
defer func() {
t.Close()
close(c)
}()
timeout := dnsTimeout
if t.ReadTimeout != 0 {
timeout = t.ReadTimeout
Expand Down

0 comments on commit cc506bc

Please sign in to comment.