Ensure SniCompletionEvent is not lost after onLookupComplete(...) (#10709)

Motivation:

In the master branch we fail fire* operations on the ChannelHandlerContext once the handler was removed. This is by design as it is "unspecified" what the semantics could be after the handler was removed and may lead to very hard to debug problems. Because of this we need to select the right ChannelHandlerContext for firing the event.

Modifications:

Choose a valid ChannelHandlerContext based on the state of the context of the handler

Result:

No more test failures
This commit is contained in:
Norman Maurer 2020-10-20 09:01:15 +02:00 committed by GitHub
parent d2e0f2a02c
commit c061bd1798
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -132,7 +132,10 @@ public abstract class AbstractSniHandler<T> extends SslClientHelloHandler<T> {
try {
onLookupComplete(ctx, hostname, future);
} finally {
fireSniCompletionEvent(ctx, hostname, future);
fireSniCompletionEvent(
// If this handler was removed as part of onLookupComplete(...) we should fire the
// event from the beginning of the pipeline as otherwise this will fail.
ctx.isRemoved() ? ctx.pipeline().firstContext() : ctx, hostname, future);
}
}