File tree 2 files changed +7
-4
lines changed
2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -151,7 +151,8 @@ public final class SSHClient {
151
151
reconnect: SSHReconnectMode ,
152
152
algorithms: SSHAlgorithms = SSHAlgorithms ( ) ,
153
153
protocolOptions: Set < SSHProtocolOption > = [ ] ,
154
- group: MultiThreadedEventLoopGroup = . init( numberOfThreads: 1 )
154
+ group: MultiThreadedEventLoopGroup = . init( numberOfThreads: 1 ) ,
155
+ connectTimeout: TimeAmount = . seconds( 30 )
155
156
) async throws -> SSHClient {
156
157
let session = try await SSHClientSession . connect (
157
158
host: host,
@@ -160,7 +161,8 @@ public final class SSHClient {
160
161
hostKeyValidator: hostKeyValidator,
161
162
algorithms: algorithms,
162
163
protocolOptions: protocolOptions,
163
- group: group
164
+ group: group,
165
+ connectTimeout: connectTimeout
164
166
)
165
167
166
168
let client = SSHClient (
Original file line number Diff line number Diff line change @@ -99,7 +99,8 @@ final class SSHClientSession {
99
99
hostKeyValidator: SSHHostKeyValidator ,
100
100
algorithms: SSHAlgorithms = SSHAlgorithms ( ) ,
101
101
protocolOptions: Set < SSHProtocolOption > = [ ] ,
102
- group: EventLoopGroup = MultiThreadedEventLoopGroup ( numberOfThreads: 1 )
102
+ group: EventLoopGroup = MultiThreadedEventLoopGroup ( numberOfThreads: 1 ) ,
103
+ connectTimeout: TimeAmount = . seconds( 30 )
103
104
) async throws -> SSHClientSession {
104
105
let handshakeHandler = ClientHandshakeHandler ( eventLoop: group. next ( ) )
105
106
var clientConfiguration = SSHClientConfiguration (
@@ -123,7 +124,7 @@ final class SSHClientSession {
123
124
handshakeHandler
124
125
] )
125
126
}
126
- . connectTimeout ( . seconds ( 30 ) )
127
+ . connectTimeout ( connectTimeout )
127
128
. channelOption ( ChannelOptions . socket ( SocketOptionLevel ( SOL_SOCKET) , SO_REUSEADDR) , value: 1 )
128
129
. channelOption ( ChannelOptions . socket ( SocketOptionLevel ( IPPROTO_TCP) , TCP_NODELAY) , value: 1 )
129
130
You can’t perform that action at this time.
0 commit comments