From 080d69137f94424b3fbfa0eeab6ed953dd1fbd8e Mon Sep 17 00:00:00 2001 From: Idel Pivnitskiy Date: Tue, 16 Feb 2021 05:04:29 -0800 Subject: [PATCH] Simplify `flushAtEnd` flag computation in `SslHandler#handlerAdded` (#11025) Motivation: The `!fastOpen` part of `active || !fastOpen` is always false. Modification: - Remove `!fastOpen` and keep only `active` as a `flushAtEnd` flag for `startHandshakeProcessing`; - Update comment; Result: Simplified `flushAtEnd` flag computation in `SslHandler#handlerAdded`. --- handler/src/main/java/io/netty/handler/ssl/SslHandler.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/handler/src/main/java/io/netty/handler/ssl/SslHandler.java b/handler/src/main/java/io/netty/handler/ssl/SslHandler.java index d46f031034..fbb102d884 100644 --- a/handler/src/main/java/io/netty/handler/ssl/SslHandler.java +++ b/handler/src/main/java/io/netty/handler/ssl/SslHandler.java @@ -1963,10 +1963,10 @@ public class SslHandler extends ByteToMessageDecoder implements ChannelOutboundH boolean fastOpen = Boolean.TRUE.equals(channel.config().getOption(ChannelOption.TCP_FASTOPEN_CONNECT)); boolean active = channel.isActive(); if (active || fastOpen) { - // Do not flush the handshake when TCP Fast Open is enabled, unless the channel is active. + // Explicitly flush the handshake only if the channel is already active. // With TCP Fast Open, we write to the outbound buffer before the TCP connect is established. - // The buffer will then be flushed as part of estabilishing the connection, saving us a round-trip. - startHandshakeProcessing(active || !fastOpen); + // The buffer will then be flushed as part of establishing the connection, saving us a round-trip. + startHandshakeProcessing(active); } }