Skip to content

Commit b1b3bbc

Browse files
committed
align code
1 parent 5239fe9 commit b1b3bbc

File tree

1 file changed

+16
-18
lines changed

1 file changed

+16
-18
lines changed

modules/transport-netty4/src/main/java/org/elasticsearch/transport/netty4/Netty4Transport.java

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -213,26 +213,24 @@ private void createServerBootstrap(ProfileSettings profileSettings, SharedGroupF
213213
serverBootstrap.childOption(ChannelOption.TCP_NODELAY, profileSettings.tcpNoDelay);
214214
serverBootstrap.childOption(ChannelOption.SO_KEEPALIVE, profileSettings.tcpKeepAlive);
215215
if (profileSettings.tcpKeepAlive) {
216-
// Netty logs a warning if it can't set the option, so try this only on supported platforms
217-
if (IOUtils.LINUX || IOUtils.MAC_OS_X) {
218-
if (profileSettings.tcpKeepIdle >= 0) {
219-
final SocketOption<Integer> keepIdleOption = NetUtils.getTcpKeepIdleSocketOptionOrNull();
220-
if (keepIdleOption != null) {
221-
serverBootstrap.childOption(NioChannelOption.of(keepIdleOption), profileSettings.tcpKeepIdle);
222-
}
216+
// Note that Netty logs a warning if it can't set the option
217+
if (profileSettings.tcpKeepIdle >= 0) {
218+
final SocketOption<Integer> keepIdleOption = NetUtils.getTcpKeepIdleSocketOptionOrNull();
219+
if (keepIdleOption != null) {
220+
serverBootstrap.childOption(NioChannelOption.of(keepIdleOption), profileSettings.tcpKeepIdle);
223221
}
224-
if (profileSettings.tcpKeepInterval >= 0) {
225-
final SocketOption<Integer> keepIntervalOption = NetUtils.getTcpKeepIntervalSocketOptionOrNull();
226-
if (keepIntervalOption != null) {
227-
serverBootstrap.childOption(NioChannelOption.of(keepIntervalOption), profileSettings.tcpKeepInterval);
228-
}
229-
222+
}
223+
if (profileSettings.tcpKeepInterval >= 0) {
224+
final SocketOption<Integer> keepIntervalOption = NetUtils.getTcpKeepIntervalSocketOptionOrNull();
225+
if (keepIntervalOption != null) {
226+
serverBootstrap.childOption(NioChannelOption.of(keepIntervalOption), profileSettings.tcpKeepInterval);
230227
}
231-
if (profileSettings.tcpKeepCount >= 0) {
232-
final SocketOption<Integer> keepCountOption = NetUtils.getTcpKeepCountSocketOptionOrNull();
233-
if (keepCountOption != null) {
234-
serverBootstrap.childOption(NioChannelOption.of(keepCountOption), profileSettings.tcpKeepCount);
235-
}
228+
229+
}
230+
if (profileSettings.tcpKeepCount >= 0) {
231+
final SocketOption<Integer> keepCountOption = NetUtils.getTcpKeepCountSocketOptionOrNull();
232+
if (keepCountOption != null) {
233+
serverBootstrap.childOption(NioChannelOption.of(keepCountOption), profileSettings.tcpKeepCount);
236234
}
237235
}
238236
}

0 commit comments

Comments
 (0)