Skip to content
Open
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
9 changes: 6 additions & 3 deletions Sources/SocketForwarder/ConnectHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand All @@ -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 {
Expand Down