You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by rs...@apache.org on 2025/08/06 21:27:36 UTC
(httpcomponents-core) branch master updated: Fix copy-paste bug in setting socket options
This is an automated email from the ASF dual-hosted git repository.
rschmitt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/httpcomponents-core.git
The following commit(s) were added to refs/heads/master by this push:
new 968a56eae Fix copy-paste bug in setting socket options
968a56eae is described below
commit 968a56eae8a51d65631d8800ab55afabc830b2dd
Author: Ryan Schmitt <rs...@apache.org>
AuthorDate: Wed Aug 6 14:24:43 2025 -0700
Fix copy-paste bug in setting socket options
---
.../java/org/apache/hc/core5/testing/nio/Http1CoreTransportTest.java | 2 ++
.../src/main/java/org/apache/hc/core5/reactor/SingleCoreIOReactor.java | 2 +-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/Http1CoreTransportTest.java b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/Http1CoreTransportTest.java
index 5dca585de..e309d3bdd 100644
--- a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/Http1CoreTransportTest.java
+++ b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/Http1CoreTransportTest.java
@@ -90,6 +90,8 @@ public Http1CoreTransportTest(final URIScheme scheme, final String tlsProtocol)
.setIOReactorConfig(
IOReactorConfig.custom()
.setSoTimeout(TIMEOUT)
+ .setTcpKeepIdle(5)
+ .setTcpKeepInterval(3)
.build())
.setRequestRouter(RequestRouter.<Supplier<AsyncServerExchangeHandler>>builder()
.addRoute(RequestRouter.LOCAL_AUTHORITY, "*", () -> new EchoHandler(2048))
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/reactor/SingleCoreIOReactor.java b/httpcore5/src/main/java/org/apache/hc/core5/reactor/SingleCoreIOReactor.java
index c56d3adc7..9bd64ca02 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/reactor/SingleCoreIOReactor.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/reactor/SingleCoreIOReactor.java
@@ -307,7 +307,7 @@ private void prepareSocket(final SocketChannel socketChannel) throws IOException
if (this.reactorConfig.getTcpKeepInterval() > 0) {
setExtendedSocketOption(socketChannel, SocketSupport.TCP_KEEPINTERVAL, this.reactorConfig.getTcpKeepInterval());
}
- if (this.reactorConfig.getTcpKeepInterval() > 0) {
+ if (this.reactorConfig.getTcpKeepCount() > 0) {
setExtendedSocketOption(socketChannel, SocketSupport.TCP_KEEPCOUNT, this.reactorConfig.getTcpKeepCount());
}
}