Skip to content

Commit 4fc2631

Browse files
committed
EpollTransport: respect extended keepalive parameters TCP_KEEPIDLE, TCP_KEEPCNT and TCP_KEEPINTVL for clients, not just servers
1 parent ee04655 commit 4fc2631

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/main/java/io/vertx/core/impl/transports/EpollTransport.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,16 @@ public void configure(ClientOptionsBase options, boolean domainSocket, Bootstrap
169169
bootstrap.option(EpollChannelOption.TCP_USER_TIMEOUT, options.getTcpUserTimeout());
170170
bootstrap.option(EpollChannelOption.TCP_QUICKACK, options.isTcpQuickAck());
171171
bootstrap.option(EpollChannelOption.TCP_CORK, options.isTcpCork());
172+
173+
if (options.isTcpKeepAlive() && options.getTcpKeepAliveIdleSeconds() != -1) {
174+
bootstrap.option(EpollChannelOption.TCP_KEEPIDLE, options.getTcpKeepAliveIdleSeconds());
175+
}
176+
if (options.isTcpKeepAlive() && options.getTcpKeepAliveCount() != -1) {
177+
bootstrap.option(EpollChannelOption.TCP_KEEPCNT, options.getTcpKeepAliveCount());
178+
}
179+
if (options.isTcpKeepAlive() && options.getTcpKeepAliveIntervalSeconds() != -1) {
180+
bootstrap.option(EpollChannelOption.TCP_KEEPINTVL, options.getTcpKeepAliveIntervalSeconds());
181+
}
172182
}
173183
Transport.super.configure(options, domainSocket, bootstrap);
174184
}

0 commit comments

Comments
 (0)