Skip to content

Commit

Permalink
Merge #3031 into 2.0.0-M4
Browse files Browse the repository at this point in the history
  • Loading branch information
violetagg committed Jan 18, 2024
2 parents 11dfee6 + c57f382 commit f060045
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021-2023 VMware, Inc. or its affiliates, All Rights Reserved.
* Copyright (c) 2021-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 @@ -998,7 +998,8 @@ boolean goAwayReceived() {
@Nullable
ChannelHandlerContext http2FrameCodecCtx() {
ChannelHandlerContext ctx = http2FrameCodecCtx;
if (ctx != null && !ctx.isRemoved()) {
// ChannelHandlerContext.isRemoved is only meant to be called from within the EventLoop
if (ctx != null && connection.channel().eventLoop().inEventLoop() && !ctx.isRemoved()) {
return ctx;
}
ctx = connection.channel().pipeline().context(Http2FrameCodec.class);
Expand All @@ -1009,7 +1010,8 @@ ChannelHandlerContext http2FrameCodecCtx() {
@Nullable
ChannelHandlerContext http2MultiplexHandlerCtx() {
ChannelHandlerContext ctx = http2MultiplexHandlerCtx;
if (ctx != null && !ctx.isRemoved()) {
// ChannelHandlerContext.isRemoved is only meant to be called from within the EventLoop
if (ctx != null && connection.channel().eventLoop().inEventLoop() && !ctx.isRemoved()) {
return ctx;
}
ctx = connection.channel().pipeline().context(Http2MultiplexHandler.class);
Expand All @@ -1020,7 +1022,8 @@ ChannelHandlerContext http2MultiplexHandlerCtx() {
@Nullable
ChannelHandlerContext h2cUpgradeHandlerCtx() {
ChannelHandlerContext ctx = h2cUpgradeHandlerCtx;
if (ctx != null && !ctx.isRemoved()) {
// ChannelHandlerContext.isRemoved is only meant to be called from within the EventLoop
if (ctx != null && connection.channel().eventLoop().inEventLoop() && !ctx.isRemoved()) {
return ctx;
}
ctx = connection.channel().pipeline().context(NettyPipeline.H2CUpgradeHandler);
Expand Down

0 comments on commit f060045

Please sign in to comment.