Skip to content

Commit

Permalink
Add a constant for the maximum number of attempts
Browse files Browse the repository at this point in the history
  • Loading branch information
jedisct1 committed Jun 28, 2022
1 parent 0e2bb13 commit 38e87f9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions dnscrypt-proxy/dnsutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 38e87f9

Please sign in to comment.