Call fireUserEventTriggered(...) before we try to modify the pipeline

Motivation:

We should call fireUserEventTriggered(...) before we try to modify the pipeline as otherwise we may end up in the situation that the handler was already removed.

Modifications:

Change ordering of calls

Result:

Test pass again
This commit is contained in:
Norman Maurer 2021-07-06 16:43:27 +02:00
parent 520d85da11
commit 37d4b5a2f7

View File

@ -117,6 +117,9 @@ public abstract class ApplicationProtocolNegotiationHandler implements ChannelHa
@Override
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
if (evt instanceof SslHandshakeCompletionEvent) {
// Let's first fire the event before we try to modify the pipeline.
ctx.fireUserEventTriggered(evt);
SslHandshakeCompletionEvent handshakeEvent = (SslHandshakeCompletionEvent) evt;
try {
if (handshakeEvent.isSuccess()) {
@ -137,7 +140,6 @@ public abstract class ApplicationProtocolNegotiationHandler implements ChannelHa
} catch (Throwable cause) {
exceptionCaught(ctx, cause);
} finally {
ctx.fireUserEventTriggered(evt);
// Handshake failures are handled in exceptionCaught(...).
if (handshakeEvent.isSuccess()) {
removeSelfIfPresent(ctx);