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)
|
||||
// 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}}
|
||||
// close(ch)
|
||||
// w.Hijack()
|
||||
// // w.Close() // Client closes connection
|
||||
// wg.Wait() // wait until everything is written out
|
||||
// w.Close() // close connection
|
||||
//
|
||||
// The server is responsible for sending the correct sequence of RRs through the
|
||||
// channel ch.
|
||||
// The server is responsible for sending the correct sequence of RRs through the channel ch.
|
||||
func (t *Transfer) Out(w ResponseWriter, q *Msg, ch chan *Envelope) error {
|
||||
for x := range ch {
|
||||
r := new(Msg)
|
||||
|
|
Loading…
Reference in New Issue