Skip to content
Open
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
2 changes: 1 addition & 1 deletion Sources/Shout/SSH.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class SSH {
/// - Throws: SSHError if the SSH session couldn't be created
public init(host: String, port: Int32 = 22, timeout: UInt = 0) throws {
self.sock = try Socket.create()
self.session = try Session()
self.session = try Session(timeout: timeout)

session.blocking = 1
try sock.connect(to: host, port: port, timeout: timeout)
Expand Down
3 changes: 2 additions & 1 deletion Sources/Shout/Session.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Session {
}
}

init() throws {
init(timeout: UInt = 0) throws {
guard Session.initResult == 0 else {
throw SSHError.genericError("libssh2_init failed")
}
Expand All @@ -36,6 +36,7 @@ class Session {
}

self.cSession = cSession
libssh2_session_set_timeout(cSession, Int(timeout))
}

func handshake(over socket: Socket) throws {
Expand Down