diff --git a/dnsredir.go b/dnsredir.go index 8fcfbe9..7a47aad 100644 --- a/dnsredir.go +++ b/dnsredir.go @@ -78,11 +78,10 @@ func (r *Dnsredir) ServeDNS(ctx context.Context, w dns.ResponseWriter, req *dns. var upstreamErr error var tryCount int32 deadline := time.Now().Add(defaultTimeout) - tryCount = 0 for time.Now().Before(deadline) { - tryCount += 1 start := time.Now() + tryCount++ host := upstream.Select() if host == nil || tryCount > upstream.maxRetry { log.Debug(errNoHealthy)