mirror of
https://github.com/SamTherapy/dnscrypt.git
synced 2024-12-22 00:50:42 +00:00
increase the default UDP buffer
This commit is contained in:
parent
10ee7b1b81
commit
ef90099c2d
1 changed files with 6 additions and 2 deletions
|
@ -18,6 +18,10 @@ const defaultReadTimeout = 2 * time.Second
|
|||
// then we start using defaultTCPIdleTimeout
|
||||
const defaultTCPIdleTimeout = 8 * time.Second
|
||||
|
||||
// defaultUDPSize is the size of the UDP read buffer. Using 1252 by default,
|
||||
// see here: https://github.com/AdguardTeam/AdGuardDNS/issues/188
|
||||
const defaultUDPSize = 1252
|
||||
|
||||
// helper struct that is used in several SetReadDeadline calls
|
||||
var longTimeAgo = time.Unix(1, 0)
|
||||
|
||||
|
@ -49,7 +53,7 @@ type Server struct {
|
|||
ResolverCert *Cert
|
||||
|
||||
// UDPSize is the default buffer size to use to read incoming UDP messages.
|
||||
// If not set it defaults to dns.MinMsgSize (512 B).
|
||||
// If not set it defaults to defaultUDPSize (1252 B).
|
||||
UDPSize int
|
||||
|
||||
// Handler to invoke. If nil, uses DefaultHandler.
|
||||
|
@ -154,7 +158,7 @@ func (s *Server) init() {
|
|||
s.tcpListeners = map[net.Listener]struct{}{}
|
||||
|
||||
if s.UDPSize == 0 {
|
||||
s.UDPSize = dns.MinMsgSize
|
||||
s.UDPSize = defaultUDPSize
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue