File tree Expand file tree Collapse file tree 2 files changed +3
-2
lines changed Expand file tree Collapse file tree 2 files changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ public class SSH {
4949 /// - Throws: SSHError if the SSH session couldn't be created
5050 public init ( host: String , port: Int32 = 22 , timeout: UInt = 0 ) throws {
5151 self . sock = try Socket . create ( )
52- self . session = try Session ( )
52+ self . session = try Session ( timeout : timeout )
5353
5454 session. blocking = 1
5555 try sock. connect ( to: host, port: port, timeout: timeout)
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ class Session {
2626 }
2727 }
2828
29- init ( ) throws {
29+ init ( timeout : UInt = 0 ) throws {
3030 guard Session . initResult == 0 else {
3131 throw SSHError . genericError ( " libssh2_init failed " )
3232 }
@@ -36,6 +36,7 @@ class Session {
3636 }
3737
3838 self . cSession = cSession
39+ libssh2_session_set_timeout ( cSession, Int ( timeout) )
3940 }
4041
4142 func handshake( over socket: Socket ) throws {
You can’t perform that action at this time.
0 commit comments