Add a constant for the maximum number of attempts

This commit is contained in:
Frank Denis 2022-06-28 18:30:15 +02:00
parent 0e2bb13254
commit 38e87f9a7b
1 changed files with 3 additions and 2 deletions

View File

@ -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)