Skip to content

Commit

Permalink
set dialer timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
sijms committed Aug 21, 2023
1 parent 2c7b5ee commit 1a639b6
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions v2/network/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -404,8 +404,13 @@ func (session *Session) Connect(ctx context.Context) error {
var loop = true
dialer := connOption.Dialer
if dialer == nil {
dialer = &net.Dialer{
Timeout: session.Context.ConnOption.Timeout,
dialer = &net.Dialer{}
if session.Context.ConnOption.Timeout > 0 {
dialer = &net.Dialer{
Timeout: session.Context.ConnOption.Timeout,
}
} else {
dialer = &net.Dialer{}
}
}
//connOption.serverIndex = 0
Expand Down

0 comments on commit 1a639b6

Please sign in to comment.