Skip to content

Commit

Permalink
Pull request: Export default ping timeout
Browse files Browse the repository at this point in the history
Merge in DNS/dnsproxy from exp-const to master

Updates AdguardTeam/AdGuardHome#1992.

Squashed commit of the following:

commit 65aa4bf
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Fri Aug 27 19:32:50 2021 +0300

    fastip: export the default ping timeout
  • Loading branch information
EugeneOne1 committed Aug 27, 2021
1 parent 27e9036 commit 24059f4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 5 additions & 1 deletion fastip/fastest.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ import (
"github.com/miekg/dns"
)

// DefaultPingWaitTimeout is the default period of time for waiting ping
// operations to finish.
const DefaultPingWaitTimeout = 1 * time.Second

// FastestAddr provides methods to determine the fastest network addresses.
type FastestAddr struct {
// ipCacheLock protects ipCache.
Expand Down Expand Up @@ -44,7 +48,7 @@ func NewFastestAddr() (f *FastestAddr) {
EnableLRU: true,
}),
pingPorts: []uint{80, 443},
PingWaitTimeout: defaultPingWaitTimeout,
PingWaitTimeout: DefaultPingWaitTimeout,
pinger: &net.Dialer{Timeout: pingTCPTimeout},
}
}
Expand Down
4 changes: 0 additions & 4 deletions fastip/ping.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ import (
"github.com/AdguardTeam/golibs/netutil"
)

// defaultPingWaitTimeout is the default period of time for waiting ping
// operations to finish.
const defaultPingWaitTimeout = 1 * time.Second

// pingTCPTimeout is a TCP connection timeout. It's higher than pingWaitTimeout
// since the slower connections will be cached anyway.
const pingTCPTimeout = 4 * time.Second
Expand Down

0 comments on commit 24059f4

Please sign in to comment.