From 528fbd10e412ad811425a542515d337974efb13d Mon Sep 17 00:00:00 2001 From: beyondkmp Date: Fri, 2 Aug 2019 09:22:09 +0800 Subject: [PATCH] Fix(dns): use closure client (#251) --- dns/resolver.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dns/resolver.go b/dns/resolver.go index ecea9adf..4e66f17c 100644 --- a/dns/resolver.go +++ b/dns/resolver.go @@ -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 {