Skip to content

Commit

Permalink
Final polish
Browse files Browse the repository at this point in the history
  • Loading branch information
daschl committed Oct 3, 2024
1 parent 4e2a1d0 commit 56cfb6f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public TcpClientChannelInitializer(final ReadOnlyTcpClientConfig config,
channel -> new TcpConnectionInfo(channel,
// ExecutionContext can be null if users used deprecated ctor
executionContext == null ? null : channelExecutionContext(channel, executionContext),
sslConfig, config.idleTimeoutMs()), true, !deferSslHandler ? sslConfig : null));
sslConfig, config.idleTimeoutMs()), true, deferSslHandler ? null : sslConfig));
}

if (config.idleTimeoutMs() > 0L) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ public final class ConnectionObserverInitializer implements ChannelInitializer {

private final ConnectionObserver observer;
private final Function<Channel, ConnectionInfo> connectionInfoFactory;
private final boolean handshakeOnActive;
private final boolean client;
@Nullable
private final SslConfig sslConfig;
Expand Down Expand Up @@ -104,7 +103,6 @@ public ConnectionObserverInitializer(final ConnectionObserver observer,
@Nullable final SslConfig sslConfig) {
this.observer = requireNonNull(observer);
this.connectionInfoFactory = requireNonNull(connectionInfoFactory);
this.handshakeOnActive = sslConfig != null;
this.client = client;
this.sslConfig = sslConfig;
}
Expand All @@ -120,11 +118,11 @@ public void init(final Channel channel) {
}
});
channel.pipeline().addLast(new ConnectionObserverHandler(observer, connectionInfoFactory,
handshakeOnActive, isFastOpen(channel), sslConfig));
sslConfig != null, isFastOpen(channel), sslConfig));
}

private boolean isFastOpen(final Channel channel) {
return client && handshakeOnActive && Boolean.TRUE.equals(channel.config().getOption(TCP_FASTOPEN_CONNECT)) &&
return client && sslConfig != null && Boolean.TRUE.equals(channel.config().getOption(TCP_FASTOPEN_CONNECT)) &&
(Epoll.isTcpFastOpenClientSideAvailable() || KQueue.isTcpFastOpenClientSideAvailable());
}

Expand Down

0 comments on commit 56cfb6f

Please sign in to comment.