You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by re...@apache.org on 2025/11/08 15:51:45 UTC
(cxf) 01/03: CXF-9173: Default SO_LINGER induce TCP RST on each connection closure (#2715)
This is an automated email from the ASF dual-hosted git repository.
reta pushed a commit to branch 3.6.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git
commit 63028ebec9e9aeef81011de4d9cf04e308ac425f
Author: Andriy Redko <dr...@gmail.com>
AuthorDate: Sat Nov 8 09:01:51 2025 -0500
CXF-9173: Default SO_LINGER induce TCP RST on each connection closure (#2715)
(cherry picked from commit 8018384606b2c1dfee8a769edfe19254d2295024)
(cherry picked from commit e5bfff5dae74ffda55f77ffdc9fbb41e14861558)
---
.../http/asyncclient/hc5/AsyncHTTPConduitFactory.java | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/rt/transports/http-hc5/src/main/java/org/apache/cxf/transport/http/asyncclient/hc5/AsyncHTTPConduitFactory.java b/rt/transports/http-hc5/src/main/java/org/apache/cxf/transport/http/asyncclient/hc5/AsyncHTTPConduitFactory.java
index 634843dc19..f23cdfec8b 100644
--- a/rt/transports/http-hc5/src/main/java/org/apache/cxf/transport/http/asyncclient/hc5/AsyncHTTPConduitFactory.java
+++ b/rt/transports/http-hc5/src/main/java/org/apache/cxf/transport/http/asyncclient/hc5/AsyncHTTPConduitFactory.java
@@ -151,9 +151,9 @@ public class AsyncHTTPConduitFactory implements HTTPConduitFactory {
private int ioThreadCount = IOReactorConfig.DEFAULT.getIoThreadCount();
private long selectInterval = IOReactorConfig.DEFAULT.getSelectInterval().toMilliseconds();
- private int soLinger = IOReactorConfig.DEFAULT.getSoLinger().toMillisecondsIntBound();
+ private TimeValue soLinger = IOReactorConfig.DEFAULT.getSoLinger();
private int soTimeout = IOReactorConfig.DEFAULT.getSoTimeout().toMillisecondsIntBound();
- private boolean soKeepalive = IOReactorConfig.DEFAULT.isSoKeepalive();
+ private boolean soKeepalive = IOReactorConfig.DEFAULT.isSoKeepAlive();
private boolean tcpNoDelay = true;
@@ -223,11 +223,13 @@ public class AsyncHTTPConduitFactory implements HTTPConduitFactory {
selectInterval = getInt(s.get(SELECT_INTERVAL), 1000);
changed |= l != selectInterval;
- i = soLinger;
- soLinger = getInt(s.get(SO_LINGER), -1);
- changed |= i != soLinger;
+ i = soLinger.toSecondsIntBound();
+ // SO_LINGER timeout is set in seconds
+ soLinger = TimeValue.ofSeconds(getInt(s.get(SO_LINGER), -1));
+ changed |= i != soLinger.toSecondsIntBound();
i = soTimeout;
+ // SO_TIMEOUT timeout is set in milliseconds
soTimeout = getInt(s.get(SO_TIMEOUT), 0);
changed |= i != soTimeout;
@@ -338,7 +340,7 @@ public class AsyncHTTPConduitFactory implements HTTPConduitFactory {
final IOReactorConfig config = IOReactorConfig.custom()
.setIoThreadCount(ioThreadCount)
.setSelectInterval(TimeValue.ofMilliseconds(selectInterval))
- .setSoLinger(TimeValue.ofMilliseconds(soLinger))
+ .setSoLinger(soLinger)
.setSoTimeout(Timeout.ofMilliseconds(soTimeout))
.setSoKeepAlive(soKeepalive)
.setTcpNoDelay(tcpNoDelay)