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 2011/09/10 13:26:05 UTC

svn commit: r1167498 - /httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncClientProtocolHandler.java

Author: olegk
Date: Sat Sep 10 11:26:05 2011
New Revision: 1167498

URL: http://svn.apache.org/viewvc?rev=1167498&view=rev
Log:
Fixed #requestReady logic in HttpAsyncClientProtocolHandler

Modified:
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncClientProtocolHandler.java

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncClientProtocolHandler.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncClientProtocolHandler.java?rev=1167498&r1=1167497&r2=1167498&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncClientProtocolHandler.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncClientProtocolHandler.java Sat Sep 10 11:26:05 2011
@@ -98,12 +98,16 @@ public class HttpAsyncClientProtocolHand
             return;
         }
         HttpAsyncClientExchangeHandler<?> handler = httpexchange.getHandler();
+        if (handler != null && handler.isDone()) {
+            httpexchange.clearHandler();
+            handler = null;
+        }
         if (handler == null) {
             handler = (HttpAsyncClientExchangeHandler<?>) conn.getContext().removeAttribute(
                     HTTP_HANDLER);
             httpexchange.setHandler(handler);
         }
-        if (handler == null || handler.isDone()) {
+        if (handler == null) {
             return;
         }
         try {
@@ -375,6 +379,10 @@ public class HttpAsyncClientProtocolHand
             this.handler = handler;
         }
 
+        public void clearHandler() {
+            this.handler = null;
+        }
+
         public MessageState getRequestState() {
             return this.requestState;
         }
@@ -424,9 +432,9 @@ public class HttpAsyncClientProtocolHand
         public void reset() {
             this.responseState = MessageState.READY;
             this.requestState = MessageState.READY;
-            this.handler = null;
             this.response = null;
             this.request = null;
+            this.timeout = 0;
         }
 
         public boolean isValid() {