Skip to content

Commit 38e87f9

Browse files
committed
Add a constant for the maximum number of attempts
1 parent 0e2bb13 commit 38e87f9

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

dnscrypt-proxy/dnsutils.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,11 +316,12 @@ func DNSExchange(
316316
) (*dns.Msg, time.Duration, bool, error) {
317317
for {
318318
cancelChannel := make(chan struct{})
319-
channel := make(chan DNSExchangeResponse, 6)
319+
maxTries := 3
320+
channel := make(chan DNSExchangeResponse, 2*maxTries)
320321
var err error
321322
options := 0
322323

323-
for tries := 0; tries < 3; tries++ {
324+
for tries := 0; tries < maxTries; tries++ {
324325
if tryFragmentsSupport {
325326
queryCopy := query.Copy()
326327
queryCopy.Id += uint16(options)

0 commit comments

Comments
 (0)