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 2008/02/22 11:02:07 UTC

svn commit: r630135 - /httpcomponents/httpcore/branches/limewire_contrib/module-nio/src/main/java/org/apache/http/nio/protocol/AsyncNHttpServiceHandler.java

Author: olegk
Date: Fri Feb 22 02:02:06 2008
New Revision: 630135

URL: http://svn.apache.org/viewvc?rev=630135&view=rev
Log:
HTTPCORE-148: Improved connection state management

Modified:
    httpcomponents/httpcore/branches/limewire_contrib/module-nio/src/main/java/org/apache/http/nio/protocol/AsyncNHttpServiceHandler.java

Modified: httpcomponents/httpcore/branches/limewire_contrib/module-nio/src/main/java/org/apache/http/nio/protocol/AsyncNHttpServiceHandler.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/branches/limewire_contrib/module-nio/src/main/java/org/apache/http/nio/protocol/AsyncNHttpServiceHandler.java?rev=630135&r1=630134&r2=630135&view=diff
==============================================================================
--- httpcomponents/httpcore/branches/limewire_contrib/module-nio/src/main/java/org/apache/http/nio/protocol/AsyncNHttpServiceHandler.java (original)
+++ httpcomponents/httpcore/branches/limewire_contrib/module-nio/src/main/java/org/apache/http/nio/protocol/AsyncNHttpServiceHandler.java Fri Feb 22 02:02:06 2008
@@ -133,7 +133,6 @@
         HttpContext context = conn.getContext();
 
         ServerConnState connState = (ServerConnState) context.getAttribute(CONN_STATE);
-        connState.reset();
 
         HttpRequest request = conn.getHttpRequest();
         request.setParams(new DefaultedHttpParams(request.getParams(), this.params));
@@ -293,10 +292,6 @@
     }
 
     public void responseReady(final NHttpServerConnection conn) {
-        if (conn.isOpen()) {
-            // Make sure there is no input stuck in the session buffer
-            conn.requestInput();
-        }
     }
 
     public void outputReady(final NHttpServerConnection conn, final ContentEncoder encoder) {
@@ -312,6 +307,10 @@
                 connState.finishOutput();
                 if (!this.connStrategy.keepAlive(response, context)) {
                     conn.close();
+                } else {
+                    // Ready to process new request
+                    connState.reset();
+                    conn.requestInput();
                 }
             }
 
@@ -405,6 +404,10 @@
         } else {
             if (!this.connStrategy.keepAlive(response, context)) {
                 conn.close();
+            } else {
+                // Ready to process new request
+                connState.reset();
+                conn.requestInput();
             }
         }