1
0
Fork 0
mirror of https://github.com/SamTherapy/dnscrypt.git synced 2024-07-02 21:56:06 +00:00

increase the default UDP buffer

This commit is contained in:
Andrey Meshkov 2021-08-31 19:34:31 +03:00
parent 10ee7b1b81
commit ef90099c2d

View file

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