Skip to content

Commit 8615374

Browse files
committed
Fix using Exec side-by-side with SFTP
1 parent c0f4eea commit 8615374

File tree

2 files changed

+6
-13
lines changed

2 files changed

+6
-13
lines changed

Sources/Citadel/Exec/ExecHandler.swift

+2-13
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ enum SSHServerError: Error {
3535

3636
final class ExecHandler: ChannelDuplexHandler {
3737
typealias InboundIn = SSHChannelData
38-
typealias InboundOut = ByteBuffer
38+
typealias InboundOut = SSHChannelData
3939
typealias OutboundIn = SSHChannelData
4040
typealias OutboundOut = SSHChannelData
4141

@@ -92,18 +92,7 @@ final class ExecHandler: ChannelDuplexHandler {
9292
}
9393

9494
func channelRead(context: ChannelHandlerContext, data: NIOAny) {
95-
let data = self.unwrapInboundIn(data)
96-
97-
guard case .byteBuffer(let bytes) = data.data else {
98-
fatalError("Unexpected read type")
99-
}
100-
101-
guard case .channel = data.type else {
102-
context.fireErrorCaught(SSHServerError.invalidDataType)
103-
return
104-
}
105-
106-
context.fireChannelRead(self.wrapInboundOut(bytes))
95+
context.fireChannelRead(data)
10796
}
10897

10998
func write(context: ChannelHandlerContext, data: NIOAny, promise: EventLoopPromise<Void>?) {

Sources/Citadel/Server.swift

+4
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@ final class SubsystemHandler: ChannelDuplexHandler {
8484
func write(context: ChannelHandlerContext, data: NIOAny, promise: EventLoopPromise<Void>?) {
8585
context.write(data, promise: promise)
8686
}
87+
88+
deinit {
89+
configured.fail(CitadelError.channelCreationFailed)
90+
}
8791
}
8892

8993
final class CitadelServerDelegate {

0 commit comments

Comments
 (0)