Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions internal/connmgr/connmanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions internal/connmgr/connmanager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
},
Expand Down