Skip to content

Commit

Permalink
Always check readTimeout configuration before pipeline checks
Browse files Browse the repository at this point in the history
  • Loading branch information
violetagg committed Mar 25, 2024
1 parent ca671ed commit 18d2f78
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1481,9 +1481,11 @@ protected void decode(ChannelHandlerContext ctx, HttpObject msg, List<Object> ou
}

void stopTimeouts(ChannelHandlerContext ctx) {
ChannelHandler handler = ctx.channel().pipeline().get(NettyPipeline.ReadTimeoutHandler);
if (handler != null) {
ctx.channel().pipeline().remove(handler);
if (readTimeout != null) {
ChannelHandler handler = ctx.channel().pipeline().get(NettyPipeline.ReadTimeoutHandler);
if (handler != null) {
ctx.channel().pipeline().remove(handler);
}
}
if (requestTimeoutFuture != null) {
requestTimeoutFuture.cancel(false);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2023 VMware, Inc. or its affiliates, All Rights Reserved.
* Copyright (c) 2011-2024 VMware, Inc. or its affiliates, All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -677,7 +677,9 @@ protected void onInboundNext(ChannelHandlerContext ctx, Object msg) {
super.onInboundNext(ctx, msg);
}
if (msg instanceof LastHttpContent) {
removeHandler(NettyPipeline.ReadTimeoutHandler);
if (readTimeout != null) {
removeHandler(NettyPipeline.ReadTimeoutHandler);
}
if (requestTimeoutFuture != null) {
requestTimeoutFuture.cancel(false);
requestTimeoutFuture = null;
Expand Down

0 comments on commit 18d2f78

Please sign in to comment.