Skip to content

Commit

Permalink
Polish
Browse files Browse the repository at this point in the history
  • Loading branch information
violetagg committed Jun 12, 2024
1 parent 7b414c1 commit d52f995
Showing 1 changed file with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -746,8 +746,9 @@ protected void onInboundNext(ChannelHandlerContext ctx, Object msg) {
}

if (msg instanceof LastHttpContent) {
LastHttpContent lastHttpContent = (LastHttpContent) msg;
if (is100Continue) {
ReferenceCountUtil.release(msg);
lastHttpContent.release();
channel().read();
return;
}
Expand All @@ -756,20 +757,20 @@ protected void onInboundNext(ChannelHandlerContext ctx, Object msg) {
log.debug(format(channel(), "HttpClientOperations received an incorrect end " +
"delimiter (previously used connection?)"));
}
ReferenceCountUtil.release(msg);
lastHttpContent.release();
return;
}
if (log.isDebugEnabled()) {
log.debug(format(channel(), "Received last HTTP packet"));
}
if (msg != LastHttpContent.EMPTY_LAST_CONTENT) {
if (lastHttpContent != LastHttpContent.EMPTY_LAST_CONTENT) {
// When there is HTTP/2 response with INBOUND HEADERS(endStream=false) followed by INBOUND DATA(endStream=true length=0),
// Netty sends LastHttpContent with empty buffer instead of EMPTY_LAST_CONTENT
if (redirecting != null || ((LastHttpContent) msg).content().readableBytes() == 0) {
ReferenceCountUtil.release(msg);
if (redirecting != null || lastHttpContent.content().readableBytes() == 0) {
lastHttpContent.release();
}
else {
super.onInboundNext(ctx, msg);
super.onInboundNext(ctx, lastHttpContent);
}
}

Expand All @@ -778,7 +779,7 @@ protected void onInboundNext(ChannelHandlerContext ctx, Object msg) {
// Whether there are subscribers or the subscriber cancels is not of interest
// Evaluated EmitResult: FAIL_TERMINATED, FAIL_OVERFLOW, FAIL_CANCELLED, FAIL_NON_SERIALIZED
// FAIL_ZERO_SUBSCRIBER
trailerHeaders.tryEmitValue(((LastHttpContent) msg).trailingHeaders());
trailerHeaders.tryEmitValue(lastHttpContent.trailingHeaders());
}

//force auto read to enable more accurate close selection now inbound is done
Expand Down

0 comments on commit d52f995

Please sign in to comment.