lib/netutil: increase dial timeout from 1 second to 5 seconds

There are real-world cases when TCP connection needs more than 1 second to be established.
This commit is contained in:
Aliaksandr Valialkin 2022-02-07 12:33:38 +02:00
parent c738739494
commit e2d12a25e0
No known key found for this signature in database
GPG Key ID: A72BEC6CD3D0DED1

View File

@ -15,7 +15,11 @@ import (
func NewTCPDialer(name, addr string) *TCPDialer {
d := &TCPDialer{
d: &net.Dialer{
Timeout: time.Second,
// The timeout for establishing a TCP connection.
// 5 seconds should be enough for the majority of cases.
Timeout: 5 * time.Second,
// How frequently to send keep-alive packets over established TCP connections.
KeepAlive: time.Second,
},