Fix(dns): use closure client (#251)

This commit is contained in:
beyondkmp 2019-08-02 09:22:09 +08:00 committed by Dreamacro
parent 85128a634d
commit 528fbd10e4

View File

@ -182,7 +182,8 @@ func (r *Resolver) batchExchange(clients []resolver, m *D.Msg) (msg *D.Msg, err
defer cancel()
fast, ctx := picker.WithContext(ctx)
for _, r := range clients {
for _, client := range clients {
r := client
fast.Go(func() (interface{}, error) {
msg, err := r.ExchangeContext(ctx, m)
if err != nil || msg.Rcode != D.RcodeSuccess {