From 38e87f9a7bbcf455c33cc7a2e43c82bb77f1ba8c Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Tue, 28 Jun 2022 18:30:15 +0200 Subject: [PATCH] Add a constant for the maximum number of attempts --- dnscrypt-proxy/dnsutils.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dnscrypt-proxy/dnsutils.go b/dnscrypt-proxy/dnsutils.go index 2bc5dfa4..5e95bc88 100644 --- a/dnscrypt-proxy/dnsutils.go +++ b/dnscrypt-proxy/dnsutils.go @@ -316,11 +316,12 @@ func DNSExchange( ) (*dns.Msg, time.Duration, bool, error) { for { cancelChannel := make(chan struct{}) - channel := make(chan DNSExchangeResponse, 6) + maxTries := 3 + channel := make(chan DNSExchangeResponse, 2*maxTries) var err error options := 0 - for tries := 0; tries < 3; tries++ { + for tries := 0; tries < maxTries; tries++ { if tryFragmentsSupport { queryCopy := query.Copy() queryCopy.Id += uint16(options)