Skip to content

Commit 968a56e

Browse files
committed
Fix copy-paste bug in setting socket options
1 parent 4b9db72 commit 968a56e

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/Http1CoreTransportTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ public Http1CoreTransportTest(final URIScheme scheme, final String tlsProtocol)
9090
.setIOReactorConfig(
9191
IOReactorConfig.custom()
9292
.setSoTimeout(TIMEOUT)
93+
.setTcpKeepIdle(5)
94+
.setTcpKeepInterval(3)
9395
.build())
9496
.setRequestRouter(RequestRouter.<Supplier<AsyncServerExchangeHandler>>builder()
9597
.addRoute(RequestRouter.LOCAL_AUTHORITY, "*", () -> new EchoHandler(2048))

httpcore5/src/main/java/org/apache/hc/core5/reactor/SingleCoreIOReactor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ private void prepareSocket(final SocketChannel socketChannel) throws IOException
307307
if (this.reactorConfig.getTcpKeepInterval() > 0) {
308308
setExtendedSocketOption(socketChannel, SocketSupport.TCP_KEEPINTERVAL, this.reactorConfig.getTcpKeepInterval());
309309
}
310-
if (this.reactorConfig.getTcpKeepInterval() > 0) {
310+
if (this.reactorConfig.getTcpKeepCount() > 0) {
311311
setExtendedSocketOption(socketChannel, SocketSupport.TCP_KEEPCOUNT, this.reactorConfig.getTcpKeepCount());
312312
}
313313
}

0 commit comments

Comments
 (0)