mirror of
https://github.com/syncthing/syncthing.git
synced 2024-11-15 18:08:45 -07:00
Take timeout into account when dialing
This commit is contained in:
parent
a4b8c2298a
commit
ed792b97c0
@ -21,7 +21,7 @@ func GetInvitationFromRelay(uri *url.URL, id syncthingprotocol.DeviceID, certs [
|
||||
return protocol.SessionInvitation{}, fmt.Errorf("Unsupported relay scheme: %v", uri.Scheme)
|
||||
}
|
||||
|
||||
rconn, err := dialer.Dial("tcp", uri.Host)
|
||||
rconn, err := dialer.DialTimeout("tcp", uri.Host, timeout)
|
||||
if err != nil {
|
||||
return protocol.SessionInvitation{}, err
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ import (
|
||||
"net/url"
|
||||
"time"
|
||||
|
||||
"github.com/syncthing/syncthing/lib/dialer"
|
||||
syncthingprotocol "github.com/syncthing/syncthing/lib/protocol"
|
||||
"github.com/syncthing/syncthing/lib/relay/protocol"
|
||||
"github.com/syncthing/syncthing/lib/sync"
|
||||
@ -189,7 +190,7 @@ func (c *staticClient) connect() error {
|
||||
}
|
||||
|
||||
t0 := time.Now()
|
||||
tcpConn, err := net.Dial("tcp", c.uri.Host)
|
||||
tcpConn, err := dialer.DialTimeout("tcp", c.uri.Host, c.connectTimeout)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user