Skip to content
Merged
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 @@ -173,12 +173,25 @@ public void exceptionCaught(ChannelHandlerContext ctx, Throwable e) {

@Override
public void channelActive(ChannelHandlerContext ctx) {
ctx.read();
readIfNeeded(ctx);
}

@Override
public void channelReadComplete(ChannelHandlerContext ctx) {
ctx.read();
readIfNeeded(ctx);
}

/**
* Requests the next read only when the channel will not do it by itself: Netty's {@code HeadContext}
* calls {@code Channel#read()} once channelActive and channelReadComplete have been fired whenever
* autoRead is on, so reading here as well would just repeat the outbound traversal and doBeginRead.
* Same guard as {@code Http2ConnectionHandler#channelReadComplete0}, which checks autoRead and nothing
* else; {@code SslHandler#readIfNeeded} adds a handshake condition on top of the same check.
*/
private static void readIfNeeded(ChannelHandlerContext ctx) {
if (!ctx.channel().config().isAutoRead()) {
Comment thread
hyperxpro marked this conversation as resolved.
ctx.read();
}
}

void finishUpdate(NettyResponseFuture<?> future, Channel channel, boolean close) {
Expand Down
Loading