mirror of
https://github.com/coredns/coredns.git
synced 2025-10-28 08:44:17 -04:00
Call wg.Add in main goroutine to avoid race conditons. (#3433)
Signed-off-by: Guangming Wang <guangming.wang@daocloud.io>
This commit is contained in:
committed by
Miek Gieben
parent
1942746c48
commit
113783ed91
@@ -109,8 +109,8 @@ func (t Transfer) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg
|
|||||||
ch := make(chan *dns.Envelope)
|
ch := make(chan *dns.Envelope)
|
||||||
tr := new(dns.Transfer)
|
tr := new(dns.Transfer)
|
||||||
wg := new(sync.WaitGroup)
|
wg := new(sync.WaitGroup)
|
||||||
go func() {
|
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
|
go func() {
|
||||||
tr.Out(w, r, ch)
|
tr.Out(w, r, ch)
|
||||||
wg.Done()
|
wg.Done()
|
||||||
}()
|
}()
|
||||||
|
|||||||
Reference in New Issue
Block a user