You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2019/11/22 21:35:56 UTC

[httpcomponents-core] branch master updated: HTTPCORE-613_2: Now allowing 0 for validaterAfterInactivity (#160)

This is an automated email from the ASF dual-hosted git repository.

olegk 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 2b3c7c3  HTTPCORE-613_2: Now allowing 0 for validaterAfterInactivity (#160)
2b3c7c3 is described below

commit 2b3c7c388fdb8b74ca296920c78365ce52ec4925
Author: Peter Frank <IM...@gmail.com>
AuthorDate: Fri Nov 22 13:35:44 2019 -0800

    HTTPCORE-613_2: Now allowing 0 for validaterAfterInactivity (#160)
    
    HTTPCORE-613: Now allowing 0 for validaterAfterInactivity
---
 .../src/main/java/org/apache/hc/core5/http2/nio/pool/H2ConnPool.java  | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/nio/pool/H2ConnPool.java b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/nio/pool/H2ConnPool.java
index 2c4bb0a..6c7d761 100644
--- a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/nio/pool/H2ConnPool.java
+++ b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/nio/pool/H2ConnPool.java
@@ -63,7 +63,7 @@ public final class H2ConnPool extends AbstractIOSessionPool<HttpHost> {
     private final Resolver<HttpHost, InetSocketAddress> addressResolver;
     private final TlsStrategy tlsStrategy;
 
-    private volatile TimeValue validateAfterInactivity;
+    private volatile TimeValue validateAfterInactivity = TimeValue.NEG_ONE_MILLISECOND;
 
     public H2ConnPool(
             final ConnectionInitiator connectionInitiator,
@@ -137,7 +137,7 @@ public final class H2ConnPool extends AbstractIOSessionPool<HttpHost> {
             final IOSession ioSession,
             final Callback<Boolean> callback) {
         final TimeValue timeValue = validateAfterInactivity;
-        if (TimeValue.isPositive(timeValue)) {
+        if (TimeValue.isNonNegative(timeValue)) {
             final long lastAccessTime = Math.min(ioSession.getLastReadTime(), ioSession.getLastWriteTime());
             final long deadline = lastAccessTime + timeValue.toMilliseconds();
             if (deadline <= System.currentTimeMillis()) {