diff --git a/internal/connmgr/connmanager.go b/internal/connmgr/connmanager.go index 0068bae84..7e7d6d63d 100644 --- a/internal/connmgr/connmanager.go +++ b/internal/connmgr/connmanager.go @@ -160,9 +160,9 @@ type Config struct { // to be specified (but not both). DialAddr func(context.Context, net.Addr) (net.Conn, error) - // Timeout specifies the amount of time to wait for a connection - // to complete before giving up. - Timeout time.Duration + // DialTimeout specifies the amount of time to wait for a connection to + // complete before giving up. + DialTimeout time.Duration } // ConnManager provides a manager to handle network connections. @@ -382,9 +382,9 @@ func (cm *ConnManager) Connect(ctx context.Context, c *ConnReq) { // Attempt to establish the connection to the address associated with the // connection request. Apply a timeout if requested. - if cm.cfg.Timeout != 0 { + if cm.cfg.DialTimeout != 0 { var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, cm.cfg.Timeout) + ctx, cancel = context.WithTimeout(ctx, cm.cfg.DialTimeout) defer cancel() } var conn net.Conn diff --git a/internal/connmgr/connmanager_test.go b/internal/connmgr/connmanager_test.go index 2153fff81..bc4e19bc8 100644 --- a/internal/connmgr/connmanager_test.go +++ b/internal/connmgr/connmanager_test.go @@ -731,8 +731,8 @@ func TestDialTimeout(t *testing.T) { return mockDialer(ctx, network, addr) } cmgr, err := New(&Config{ - Dial: timeoutDialer, - Timeout: dialTimeout, + Dial: timeoutDialer, + DialTimeout: dialTimeout, }) if err != nil { t.Fatalf("New error: %v", err) diff --git a/server.go b/server.go index 25307f8b2..733977d32 100644 --- a/server.go +++ b/server.go @@ -4369,7 +4369,7 @@ func newServer(ctx context.Context, profiler *profileServer, RetryDuration: connectionRetryInterval, TargetOutbound: s.targetOutbound, Dial: s.attemptDcrdDial, - Timeout: cfg.DialTimeout, + DialTimeout: cfg.DialTimeout, OnConnection: func(c *connmgr.ConnReq, conn net.Conn) { s.outboundPeerConnected(ctx, c, conn) },