From 294e987e4716a1fb327f91034ad086462b337a68 Mon Sep 17 00:00:00 2001 From: Trustin Lee Date: Tue, 2 Jul 2019 14:43:58 +0900 Subject: [PATCH] Ignore `SslHandshakeCompletionEvent` (#1874) Motivation: Since Netty 4.1.37, `SslHandler` emits an `SslHandshakeCompletionEvent` when a TLS handshake is complete. It triggers a log message at WARN level currently. Modifications: - Add `SslHandshakeCompletionEvent` to the known user events. Result: - Less noise --- .../java/com/linecorp/armeria/client/HttpSessionHandler.java | 2 ++ .../java/com/linecorp/armeria/server/HttpServerHandler.java | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/com/linecorp/armeria/client/HttpSessionHandler.java b/core/src/main/java/com/linecorp/armeria/client/HttpSessionHandler.java index 3780942b942..10ec39e3469 100644 --- a/core/src/main/java/com/linecorp/armeria/client/HttpSessionHandler.java +++ b/core/src/main/java/com/linecorp/armeria/client/HttpSessionHandler.java @@ -49,6 +49,7 @@ import io.netty.handler.codec.http2.Http2ConnectionPrefaceAndSettingsFrameWrittenEvent; import io.netty.handler.codec.http2.Http2Settings; import io.netty.handler.ssl.SslCloseCompletionEvent; +import io.netty.handler.ssl.SslHandshakeCompletionEvent; import io.netty.util.ReferenceCountUtil; import io.netty.util.concurrent.Promise; @@ -284,6 +285,7 @@ public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exc } if (evt instanceof Http2ConnectionPrefaceAndSettingsFrameWrittenEvent || + evt instanceof SslHandshakeCompletionEvent || evt instanceof SslCloseCompletionEvent || evt instanceof ChannelInputShutdownReadComplete) { // Expected events diff --git a/core/src/main/java/com/linecorp/armeria/server/HttpServerHandler.java b/core/src/main/java/com/linecorp/armeria/server/HttpServerHandler.java index 65a1d6cd490..3d0f10a5e4f 100644 --- a/core/src/main/java/com/linecorp/armeria/server/HttpServerHandler.java +++ b/core/src/main/java/com/linecorp/armeria/server/HttpServerHandler.java @@ -89,6 +89,7 @@ import io.netty.handler.codec.http2.Http2Settings; import io.netty.handler.ssl.SslCloseCompletionEvent; import io.netty.handler.ssl.SslHandler; +import io.netty.handler.ssl.SslHandshakeCompletionEvent; final class HttpServerHandler extends ChannelInboundHandlerAdapter implements HttpServer { @@ -643,7 +644,8 @@ public void channelReadComplete(ChannelHandlerContext ctx) throws Exception { @Override public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception { - if (evt instanceof SslCloseCompletionEvent || + if (evt instanceof SslHandshakeCompletionEvent || + evt instanceof SslCloseCompletionEvent || evt instanceof ChannelInputShutdownReadComplete) { // Expected events return;