Skip to content

Commit a174c41

Browse files
committed
EpollTransport: respect extended keepalive parameters TCP_KEEPIDLE, TCP_KEEPCNT and TCP_KEEPINTVL for clients, not just servers
1 parent 98983a8 commit a174c41

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
@@ -168,6 +168,16 @@ public void configure(ClientOptionsBase options, boolean domainSocket, Bootstrap
168168
bootstrap.option(EpollChannelOption.TCP_USER_TIMEOUT, options.getTcpUserTimeout());
169169
bootstrap.option(EpollChannelOption.TCP_QUICKACK, options.isTcpQuickAck());
170170
bootstrap.option(EpollChannelOption.TCP_CORK, options.isTcpCork());
171+
172+
if (options.isTcpKeepAlive() && options.getTcpKeepAliveIdleSeconds() != -1) {
173+
bootstrap.option(EpollChannelOption.TCP_KEEPIDLE, options.getTcpKeepAliveIdleSeconds());
174+
}
175+
if (options.isTcpKeepAlive() && options.getTcpKeepAliveCount() != -1) {
176+
bootstrap.option(EpollChannelOption.TCP_KEEPCNT, options.getTcpKeepAliveCount());
177+
}
178+
if (options.isTcpKeepAlive() && options.getTcpKeepAliveIntervalSeconds() != -1) {
179+
bootstrap.option(EpollChannelOption.TCP_KEEPINTVL, options.getTcpKeepAliveIntervalSeconds());
180+
}
171181
}
172182
Transport.super.configure(options, domainSocket, bootstrap);
173183
}

0 commit comments

Comments
 (0)