Skip to content

Commit

Permalink
Merge afb5b08 into 1.2.0-M3
Browse files Browse the repository at this point in the history
  • Loading branch information
violetagg committed May 21, 2024
2 parents 9fcdddc + afb5b08 commit 1dd50e5
Showing 1 changed file with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -793,10 +793,13 @@ void testRequestTimeout(HttpServer server, HttpClient client) throws Exception {
})
.handle((req, res) ->
res.withConnection(conn -> {
ChannelHandler handler = conn.channel().pipeline().get(NettyPipeline.ReadTimeoutHandler);
if (handler != null) {
handlerAvailable.get().add(true);
timeout.get().add(((ReadTimeoutHandler) handler).getReaderIdleTimeInMillis());
if (!((serverProtocols.length == 2 && serverProtocols[1] == HttpProtocol.H2C) &&
(clientProtocols.length == 2 && clientProtocols[1] == HttpProtocol.H2C))) {
ChannelHandler handler = conn.channel().pipeline().get(NettyPipeline.ReadTimeoutHandler);
if (handler != null) {
handlerAvailable.get().add(true);
timeout.get().add(((ReadTimeoutHandler) handler).getReaderIdleTimeInMillis());
}
}
conn.onTerminate().subscribe(null, null, () -> {
onTerminate.get().add(conn.channel().isActive() &&
Expand Down Expand Up @@ -1030,8 +1033,6 @@ static final class RequestTimeoutTestChannelInboundHandler extends ChannelInboun
final AtomicReference<List<Long>> timeout;
final CountDownLatch latch;

boolean added;

RequestTimeoutTestChannelInboundHandler(
AtomicReference<List<Boolean>> handlerAvailable,
AtomicReference<List<Boolean>> onTerminate,
Expand All @@ -1044,16 +1045,15 @@ static final class RequestTimeoutTestChannelInboundHandler extends ChannelInboun
}
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) {
if (!added && msg instanceof HttpContent) {
ctx.fireChannelRead(msg);

if (msg instanceof HttpRequest) {
ChannelHandler handler = ctx.channel().pipeline().get(NettyPipeline.ReadTimeoutHandler);
if (handler != null) {
handlerAvailable.get().add(true);
timeout.get().add(((ReadTimeoutHandler) handler).getReaderIdleTimeInMillis());
}
added = true;
}

ctx.fireChannelRead(msg);
}

@Override
Expand Down

0 comments on commit 1dd50e5

Please sign in to comment.