Skip to content

Commit

Permalink
Move read request from handlerAdded to channelRegistered (#2289)
Browse files Browse the repository at this point in the history
Related to #1873
  • Loading branch information
violetagg authored Jun 14, 2022
1 parent 74f46fa commit 87fb283
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,6 @@ final class HttpTrafficHandler extends ChannelHandlerAdapter implements Runnable
public void handlerAdded(ChannelHandlerContext ctx) throws Exception {
super.handlerAdded(ctx);
this.ctx = ctx;
if (HttpServerOperations.log.isDebugEnabled()) {
HttpServerOperations.log.debug(format(ctx.channel(), "New http connection, requesting read"));
}
ctx.read();
}

@Override
Expand Down Expand Up @@ -266,6 +262,16 @@ else if (overflow) {
ctx.fireChannelRead(msg);
}

@Override
public void channelRegistered(ChannelHandlerContext ctx) {
ctx.fireChannelRegistered();
// Need to move read operation from handlerAdded to channelRegistered
if (HttpServerOperations.log.isDebugEnabled()) {
HttpServerOperations.log.debug(format(ctx.channel(), "New http connection, requesting read"));
}
ctx.read();
}

void sendDecodingFailures(Throwable t, Object msg) {
persistentConnection = false;
HttpServerOperations.sendDecodingFailures(ctx, listener, secure, t, msg);
Expand Down

0 comments on commit 87fb283

Please sign in to comment.