mirror of
https://github.com/apple/container.git
synced 2026-07-12 20:47:04 +00:00
- Closes #794 - TCP port forwarding currently fails for server-first protocols (SMTP, FTP, SSH, PostgreSQL) because the backend connection is only established when the client sends data.
This commit is contained in:
@@ -35,9 +35,6 @@ extension ConnectHandler: ChannelInboundHandler {
|
||||
typealias OutboundOut = ByteBuffer
|
||||
|
||||
func channelRead(context: ChannelHandlerContext, data: NIOAny) {
|
||||
if self.pendingBytes.isEmpty {
|
||||
self.connectToServer(context: context)
|
||||
}
|
||||
self.pendingBytes.append(data)
|
||||
}
|
||||
|
||||
@@ -46,6 +43,12 @@ extension ConnectHandler: ChannelInboundHandler {
|
||||
self.log?[metadataKey: "proxy"] = "\(context.channel.localAddress?.description ?? "none")"
|
||||
self.log?[metadataKey: "server"] = "\(context.channel.remoteAddress?.description ?? "none")"
|
||||
}
|
||||
|
||||
func channelActive(context: ChannelHandlerContext) {
|
||||
self.log?.trace("frontend - channel active, connecting to backend")
|
||||
self.connectToServer(context: context)
|
||||
context.fireChannelActive()
|
||||
}
|
||||
}
|
||||
|
||||
extension ConnectHandler: RemovableChannelHandler {
|
||||
|
||||
Reference in New Issue
Block a user