hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1794129 - /httpcomponents/httpcore/branches/4.4.x/httpcore-nio/src/main/java/org/apache/http/nio/pool/AbstractNIOConnPool.java
Date Sat, 06 May 2017 09:07:54 GMT
Author: olegk
Date: Sat May  6 09:07:54 2017
New Revision: 1794129

URL: http://svn.apache.org/viewvc?rev=1794129&view=rev
Log:
HTTPCORE-463: Fixed incorrect use of connect timeout setting in AbstractNIOConnPool

Modified:
    httpcomponents/httpcore/branches/4.4.x/httpcore-nio/src/main/java/org/apache/http/nio/pool/AbstractNIOConnPool.java

Modified: httpcomponents/httpcore/branches/4.4.x/httpcore-nio/src/main/java/org/apache/http/nio/pool/AbstractNIOConnPool.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/branches/4.4.x/httpcore-nio/src/main/java/org/apache/http/nio/pool/AbstractNIOConnPool.java?rev=1794129&r1=1794128&r2=1794129&view=diff
==============================================================================
--- httpcomponents/httpcore/branches/4.4.x/httpcore-nio/src/main/java/org/apache/http/nio/pool/AbstractNIOConnPool.java
(original)
+++ httpcomponents/httpcore/branches/4.4.x/httpcore-nio/src/main/java/org/apache/http/nio/pool/AbstractNIOConnPool.java
Sat May  6 09:07:54 2017
@@ -272,8 +272,10 @@ public abstract class AbstractNIOConnPoo
         final BasicFuture<E> future = new BasicFuture<E>(callback);
         this.lock.lock();
         try {
-            final long timeout = connectTimeout > 0 ? tunit.toMillis(connectTimeout) :
0;
-            final LeaseRequest<T, C, E> request = new LeaseRequest<T, C, E>(route,
state, timeout, leaseTimeout, future);
+            final LeaseRequest<T, C, E> request = new LeaseRequest<T, C, E>(route,
state,
+                    connectTimeout >= 0 ? tunit.toMillis(connectTimeout) : -1,
+                    leaseTimeout > 0 ? tunit.toMillis(leaseTimeout) : 0,
+                    future);
             final boolean completed = processPendingRequest(request);
             if (!request.isDone() && !completed) {
                 this.leasingRequests.add(request);
@@ -444,9 +446,10 @@ public abstract class AbstractNIOConnPoo
 
             final SessionRequest sessionRequest = this.ioreactor.connect(
                     remoteAddress, localAddress, route, this.sessionRequestCallback);
-            final int timout = request.getConnectTimeout() < Integer.MAX_VALUE ?
-                    (int) request.getConnectTimeout() : Integer.MAX_VALUE;
-            sessionRequest.setConnectTimeout(timout);
+            final long connectTimeout = request.getConnectTimeout();
+            if (connectTimeout >= 0) {
+                sessionRequest.setConnectTimeout(connectTimeout < Integer.MAX_VALUE ?
(int) connectTimeout : Integer.MAX_VALUE);
+            }
             this.pending.add(sessionRequest);
             pool.addPending(sessionRequest, request.getFuture());
             return true;



Mime
View raw message