You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2013/08/31 01:28:34 UTC

svn commit: r1519120 - /tomcat/trunk/java/org/apache/coyote/ajp/AjpNioProcessor.java

Author: markt
Date: Fri Aug 30 23:28:33 2013
New Revision: 1519120

URL: http://svn.apache.org/r1519120
Log:
Add the keptAlive flag (copied from APR) so that the first requst uses a blocking read as there should be data to read immediately after the connection has been established.
Use the new method to set timeouts.

Modified:
    tomcat/trunk/java/org/apache/coyote/ajp/AjpNioProcessor.java

Modified: tomcat/trunk/java/org/apache/coyote/ajp/AjpNioProcessor.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ajp/AjpNioProcessor.java?rev=1519120&r1=1519119&r2=1519120&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/ajp/AjpNioProcessor.java (original)
+++ tomcat/trunk/java/org/apache/coyote/ajp/AjpNioProcessor.java Fri Aug 30 23:28:33 2013
@@ -96,16 +96,18 @@ public class AjpNioProcessor extends Abs
         // Error flag
         error = false;
 
+        boolean keptAlive = false;
+
         while (!error && !endpoint.isPaused()) {
             // Parsing the request header
             try {
                 // Get first message of the request
-                if (!readMessage(requestHeaderMessage, false)) {
+                if (!readMessage(requestHeaderMessage, !keptAlive)) {
                     break;
                 }
                 // Set back timeout if keep alive timeout is enabled
                 if (keepAliveTimeout > 0) {
-                    socket.setTimeout(soTimeout);
+                    setTimeout(socketWrapper, soTimeout);
                 }
                 // Check message type, process right away and break if
                 // not regular request processing
@@ -133,6 +135,7 @@ public class AjpNioProcessor extends Abs
                     recycle(true);
                     break;
                 }
+                keptAlive = true;
                 request.setStartTime(System.currentTimeMillis());
             } catch (IOException e) {
                 error = true;
@@ -210,7 +213,7 @@ public class AjpNioProcessor extends Abs
             rp.setStage(org.apache.coyote.Constants.STAGE_KEEPALIVE);
             // Set keep alive timeout if enabled
             if (keepAliveTimeout > 0) {
-                socket.setTimeout(keepAliveTimeout);
+                setTimeout(socketWrapper, keepAliveTimeout);
             }
 
             recycle(false);



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