Skip to content

Commit

Permalink
Bring back queue to public API
Browse files Browse the repository at this point in the history
  • Loading branch information
gaetanzanella committed Apr 22, 2023
1 parent 054b7a7 commit 3f79e1f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Sources/SSHClient/SSHConnection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,16 @@ public class SSHConnection: @unchecked Sendable {
public init(host: String,
port: UInt16,
authentication: SSHAuthentication,
queue: DispatchQueue? = nil,
defaultTimeout: TimeInterval = 15.0) {
ioConnection = IOSSHConnection(
host: host,
port: port,
authentication: authentication,
eventLoopGroup: MultiThreadedEventLoopGroup.ssh
)
updateQueue = queue ?? DispatchQueue(label: "ssh_connection_queue")
self.defaultTimeout = defaultTimeout
updateQueue = DispatchQueue(label: "ssh_connection")
setupIOConnection()
}

Expand Down Expand Up @@ -78,12 +79,13 @@ public class SSHConnection: @unchecked Sendable {

@discardableResult
public func requestShell(withTimeout timeout: TimeInterval? = nil,
queue: DispatchQueue? = nil,
completion: @escaping (Result<SSHShell, Error>) -> Void) -> SSHTask {
let shell = SSHShell(
ioShell: IOSSHShell(
eventLoop: MultiThreadedEventLoopGroup.ssh.any()
),
updateQueue: updateQueue
updateQueue: queue ?? updateQueue
)
let task = SSHSessionStartingTask(
session: shell,
Expand All @@ -97,13 +99,14 @@ public class SSHConnection: @unchecked Sendable {

@discardableResult
public func requestSFTPClient(withTimeout timeout: TimeInterval? = nil,
queue: DispatchQueue? = nil,
completion: @escaping (Result<SFTPClient, Error>) -> Void) -> SSHTask {
let sftpClient = SFTPClient(
sftpChannel: IOSFTPChannel(
idAllocator: MonotonicRequestIDAllocator(start: 0),
eventLoop: MultiThreadedEventLoopGroup.ssh.any()
),
updateQueue: updateQueue
updateQueue: queue ?? updateQueue
)
let task = SSHSessionStartingTask(
session: sftpClient,
Expand Down

0 comments on commit 3f79e1f

Please sign in to comment.