Merge pull request #7 from anyproto/update-dial-timeout

Update dial timeout
This commit is contained in:
Mikhail Rakhmanov 2023-05-29 16:34:36 +02:00 committed by GitHub
commit 85ec3e2313
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -113,7 +113,7 @@ func (d *dialer) Dial(ctx context.Context, peerId string) (p peer.Peer, err erro
func (d *dialer) handshake(ctx context.Context, addr, peerId string) (conn drpc.Conn, sc sec.SecureConn, err error) { func (d *dialer) handshake(ctx context.Context, addr, peerId string) (conn drpc.Conn, sc sec.SecureConn, err error) {
st := time.Now() st := time.Now()
// TODO: move dial timeout to config // TODO: move dial timeout to config
tcpConn, err := net.DialTimeout("tcp", addr, time.Second*3) tcpConn, err := net.DialTimeout("tcp", addr, time.Second*15)
if err != nil { if err != nil {
return nil, nil, fmt.Errorf("dialTimeout error: %v; since start: %v", err, time.Since(st)) return nil, nil, fmt.Errorf("dialTimeout error: %v; since start: %v", err, time.Since(st))
} }