tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject svn commit: r1593273 - in /tomcat/trunk/java/org/apache/coyote/http11: Http11Nio2Processor.java InternalNio2InputBuffer.java
Date Thu, 08 May 2014 13:27:58 GMT
Author: remm
Date: Thu May  8 13:27:56 2014
New Revision: 1593273

URL: http://svn.apache.org/r1593273
Log:
- Improve comet keepalive cleanup (if a read pending it is not possible to interrupt it),
and do the same for async.

Modified:
    tomcat/trunk/java/org/apache/coyote/http11/Http11Nio2Processor.java
    tomcat/trunk/java/org/apache/coyote/http11/InternalNio2InputBuffer.java

Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11Nio2Processor.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11Nio2Processor.java?rev=1593273&r1=1593272&r2=1593273&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/Http11Nio2Processor.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/Http11Nio2Processor.java Thu May  8 13:27:56
2014
@@ -132,9 +132,13 @@ public class Http11Nio2Processor extends
             if (keepAlive) {
                 inputBuffer.nextRequest();
                 outputBuffer.nextRequest();
-                // Following Comet processing, a read is still pending, so
-                // keep the processor associated
-                return SocketState.LONG;
+                if (((InternalNio2InputBuffer) inputBuffer).isPending()) {
+                    // Following comet processing, a read is still pending, so
+                    // keep the processor associated
+                    return SocketState.LONG;
+                } else {
+                    return SocketState.OPEN;
+                }
             } else {
                 return SocketState.CLOSED;
             }
@@ -144,6 +148,18 @@ public class Http11Nio2Processor extends
     }
 
     @Override
+    public SocketState asyncDispatch(SocketStatus status) {
+        SocketState state = super.asyncDispatch(status);
+        if (state == SocketState.OPEN && ((InternalNio2InputBuffer) inputBuffer).isPending())
{
+            // Following async processing, a read is still pending, so
+            // keep the processor associated
+            return SocketState.LONG;
+        } else {
+            return state;
+        }
+    }
+
+    @Override
     protected void registerForEvent(boolean read, boolean write) {
         if (read) {
             ((InternalNio2InputBuffer) inputBuffer).registerReadInterest();

Modified: tomcat/trunk/java/org/apache/coyote/http11/InternalNio2InputBuffer.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/InternalNio2InputBuffer.java?rev=1593273&r1=1593272&r2=1593273&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/InternalNio2InputBuffer.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/InternalNio2InputBuffer.java Thu May  8 13:27:56
2014
@@ -124,6 +124,10 @@ public class InternalNio2InputBuffer ext
         interest = false;
     }
 
+    public boolean isPending() {
+        return readPending;
+    }
+
     // ------------------------------------------------------ Protected Methods
 
     @Override



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message