Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -199,14 +199,14 @@ public void channelRead(ChannelHandlerContext ctx, Object msg) {
ctx.pipeline().remove(this);
break;
default:
log.warn("Unsupported protocol version: {}", connectMessage.variableHeader().version());
log.debug("Unsupported protocol version: {}", connectMessage.variableHeader().version());
}
}

@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
// simple strategy: shutdown the channel directly
log.warn("ctx: {}, cause:", ctx, cause);
log.debug("ctx: {}, cause:", ctx, cause);
eventCollector.report(getLocal(ChannelError.class).peerAddress(remoteAddr).cause(cause));
ctx.channel().close();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,16 @@
import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.channel.ChannelPipeline;
import io.netty.handler.codec.haproxy.HAProxyMessage;
import lombok.extern.slf4j.Slf4j;

import java.net.InetSocketAddress;
import java.util.Iterator;
import java.util.Map;

/**
* This handler is used to parse the HAProxy protocol message and extract the real IP and port of the client.
*/
@Slf4j
public class ProxyProtocolHandler extends ChannelInboundHandlerAdapter {

@Override
Expand Down Expand Up @@ -73,4 +76,10 @@ public void channelRead(ChannelHandlerContext ctx, Object msg) {
ctx.pipeline().remove(this);
}
}

@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
log.debug("ctx: {}, cause:", ctx, cause);
}

}
Loading