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`.
This commit is contained in:
Idel Pivnitskiy 2021-02-16 05:04:29 -08:00 committed by Chris Vest
parent d60b1651fc
commit b29df0f87a

View File

@ -1951,10 +1951,10 @@ public class SslHandler extends ByteToMessageDecoder {
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);
}
}