Skip to content

Commit 77a3af0

Browse files
authored
Always check idleTimeout configuration before pipeline checks (#3117)
1 parent 0fd616d commit 77a3af0

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

reactor-netty-http/src/main/java/reactor/netty/http/server/HttpTrafficHandler.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2011-2023 VMware, Inc. or its affiliates, All Rights Reserved.
2+
* Copyright (c) 2011-2024 VMware, Inc. or its affiliates, All Rights Reserved.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -148,7 +148,9 @@ public void channelRead(ChannelHandlerContext ctx, Object msg) {
148148
}
149149
// read message and track if it was keepAlive
150150
if (msg instanceof HttpRequest) {
151-
IdleTimeoutHandler.removeIdleTimeoutHandler(ctx.pipeline());
151+
if (idleTimeout != null) {
152+
IdleTimeoutHandler.removeIdleTimeoutHandler(ctx.pipeline());
153+
}
152154

153155
final HttpRequest request = (HttpRequest) msg;
154156

reactor-netty-http/src/main/java/reactor/netty/http/server/IdleTimeoutHandler.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2022-2023 VMware, Inc. or its affiliates, All Rights Reserved.
2+
* Copyright (c) 2022-2024 VMware, Inc. or its affiliates, All Rights Reserved.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -53,7 +53,7 @@ protected void channelIdle(ChannelHandlerContext ctx, IdleStateEvent evt) {
5353
}
5454

5555
static void addIdleTimeoutHandler(ChannelPipeline pipeline, @Nullable Duration idleTimeout) {
56-
if (pipeline.get(NettyPipeline.IdleTimeoutHandler) == null && idleTimeout != null) {
56+
if (idleTimeout != null && pipeline.get(NettyPipeline.IdleTimeoutHandler) == null) {
5757
String baseName = null;
5858
if (pipeline.get(NettyPipeline.HttpCodec) != null) {
5959
baseName = NettyPipeline.HttpCodec;

0 commit comments

Comments
 (0)