Fire SniCompletionEvent after onLookupComplete(...) was called (#10688)

Motivation:

Users may want to do special actions when onComplete(...) was called and depend on these once they receive the SniCompletionEvent

Modifications:

Switch order and so call onLookupComplete(...) before we fire the event

Result:

Fixes https://github.com/netty/netty/issues/10655
This commit is contained in:
Norman Maurer 2020-10-15 21:01:03 +02:00
parent 5b00058fa7
commit 647dbe0244

View File

@ -129,8 +129,11 @@ public abstract class AbstractSniHandler<T> extends SslClientHelloHandler<T> {
@Override
protected void onLookupComplete(ChannelHandlerContext ctx, Future<T> future) throws Exception {
fireSniCompletionEvent(ctx, hostname, future);
onLookupComplete(ctx, hostname, future);
try {
onLookupComplete(ctx, hostname, future);
} finally {
fireSniCompletionEvent(ctx, hostname, future);
}
}
/**
@ -149,7 +152,7 @@ public abstract class AbstractSniHandler<T> extends SslClientHelloHandler<T> {
protected abstract void onLookupComplete(ChannelHandlerContext ctx,
String hostname, Future<T> future) throws Exception;
private void fireSniCompletionEvent(ChannelHandlerContext ctx, String hostname, Future<T> future) {
private static void fireSniCompletionEvent(ChannelHandlerContext ctx, String hostname, Future<?> future) {
Throwable cause = future.cause();
if (cause == null) {
ctx.fireUserEventTriggered(new SniCompletionEvent(hostname));