diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/io/SocketConfig.java b/httpcore5/src/main/java/org/apache/hc/core5/http/io/SocketConfig.java index 951f7e71ed..f7f33f1e62 100644 --- a/httpcore5/src/main/java/org/apache/hc/core5/http/io/SocketConfig.java +++ b/httpcore5/src/main/java/org/apache/hc/core5/http/io/SocketConfig.java @@ -239,14 +239,14 @@ public static class Builder { this.soTimeout = DEFAULT_SOCKET_TIMEOUT; this.soReuseAddress = false; this.soLinger = TimeValue.NEG_ONE_SECOND; - this.soKeepAlive = false; + this.soKeepAlive = true; this.tcpNoDelay = true; this.sndBufSize = 0; this.rcvBufSize = 0; this.backlogSize = 0; - this.tcpKeepIdle = -1; - this.tcpKeepInterval = -1; - this.tcpKeepCount = -1; + this.tcpKeepIdle = 5; + this.tcpKeepInterval = 5; + this.tcpKeepCount = 3; this.socksProxyAddress = null; } @@ -318,7 +318,7 @@ public Builder setSoLinger(final TimeValue soLinger) { * Determines the default value of the {@link SocketOptions#SO_KEEPALIVE} parameter * for newly created sockets. *

- * Default: {@code false} + * Default: {@code true} *

* * @return this instance. @@ -395,7 +395,7 @@ public Builder setBacklogSize(final int backlogSize) { * Determines the time (in seconds) the connection needs to remain idle before TCP starts * sending keepalive probes. *

- * Default: {@code -1} (system default) + * Default: {@code 5} *

* * @return this instance. @@ -409,7 +409,7 @@ public Builder setTcpKeepIdle(final int tcpKeepIdle) { /** * Determines the time (in seconds) between individual keepalive probes. *

- * Default: {@code -1} (system default) + * Default: {@code 5} *

* * @return this instance. @@ -423,7 +423,7 @@ public Builder setTcpKeepInterval(final int tcpKeepInterval) { /** * Determines the maximum number of keepalive probes TCP should send before dropping the connection. *

- * Default: {@code -1} (system default) + * Default: {@code 3} *

* * @return this instance. diff --git a/httpcore5/src/main/java/org/apache/hc/core5/reactor/IOReactorConfig.java b/httpcore5/src/main/java/org/apache/hc/core5/reactor/IOReactorConfig.java index 87fef3d7b7..a46a33b907 100644 --- a/httpcore5/src/main/java/org/apache/hc/core5/reactor/IOReactorConfig.java +++ b/httpcore5/src/main/java/org/apache/hc/core5/reactor/IOReactorConfig.java @@ -318,15 +318,15 @@ public static void setDefaultMaxIOThreadCount(final int defaultMaxIOThreadCount) this.soTimeout = Timeout.ZERO_MILLISECONDS; this.soReuseAddress = false; this.soLinger = TimeValue.NEG_ONE_SECOND; - this.soKeepAlive = false; + this.soKeepAlive = true; this.tcpNoDelay = true; this.trafficClass = 0; this.sndBufSize = 0; this.rcvBufSize = 0; this.backlogSize = 0; - this.tcpKeepIdle = -1; - this.tcpKeepInterval = -1; - this.tcpKeepCount = -1; + this.tcpKeepIdle = 5; + this.tcpKeepInterval = 5; + this.tcpKeepCount = 3; this.socksProxyAddress = null; this.socksProxyUsername = null; this.socksProxyPassword = null; @@ -436,7 +436,7 @@ public Builder setSoLinger(final TimeValue soLinger) { * Sets the default value of the {@link SocketOptions#SO_KEEPALIVE} parameter * for newly created sockets. *

- * Default: {@code -1} + * Default: {@code true} *

* * @return this instance. @@ -526,6 +526,9 @@ public Builder setBacklogSize(final int backlogSize) { /** * Sets the time (in seconds) the connection needs to remain idle before TCP starts * sending keepalive probes. + *

+ * Default: {@code 5} + *

* * @return this instance. * @since 5.3 @@ -537,6 +540,9 @@ public Builder setTcpKeepIdle(final int tcpKeepIdle) { /** * Sets the time (in seconds) between individual keepalive probes. + *

+ * Default: {@code 5} + *

* * @return this instance. * @since 5.3 @@ -548,6 +554,9 @@ public Builder setTcpKeepInterval(final int tcpKeepInterval) { /** * Sets the maximum number of keepalive probes TCP should send before dropping the connection. + *

+ * Default: {@code 3} + *

* * @return this instance. * @since 5.3