doc: fix xfr example. (#1062)
* doc: fix xfr example. The currently example code has a data race, put in the proper code. Fixes: #1061 Signed-off-by: Miek Gieben <miek@miek.nl> * Feedback Signed-off-by: Miek Gieben <miek@miek.nl>
This commit is contained in:
parent
bfd8601222
commit
711e0fd90d
13
xfr.go
13
xfr.go
|
@ -182,14 +182,17 @@ func (t *Transfer) inIxfr(q *Msg, c chan *Envelope) {
|
||||||
//
|
//
|
||||||
// ch := make(chan *dns.Envelope)
|
// ch := make(chan *dns.Envelope)
|
||||||
// tr := new(dns.Transfer)
|
// tr := new(dns.Transfer)
|
||||||
// go tr.Out(w, r, ch)
|
// var wg sync.WaitGroup
|
||||||
|
// go func() {
|
||||||
|
// tr.Out(w, r, ch)
|
||||||
|
// wg.Done()
|
||||||
|
// }()
|
||||||
// ch <- &dns.Envelope{RR: []dns.RR{soa, rr1, rr2, rr3, soa}}
|
// ch <- &dns.Envelope{RR: []dns.RR{soa, rr1, rr2, rr3, soa}}
|
||||||
// close(ch)
|
// close(ch)
|
||||||
// w.Hijack()
|
// wg.Wait() // wait until everything is written out
|
||||||
// // w.Close() // Client closes connection
|
// w.Close() // close connection
|
||||||
//
|
//
|
||||||
// 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 {
|
||||||
for x := range ch {
|
for x := range ch {
|
||||||
r := new(Msg)
|
r := new(Msg)
|
||||||
|
|
Loading…
Reference in New Issue