You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2006/12/11 02:32:06 UTC

svn commit: r485456 - /tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java

Author: remm
Date: Sun Dec 10 17:32:05 2006
New Revision: 485456

URL: http://svn.apache.org/viewvc?view=rev&rev=485456
Log:
- readTimeout should behave how it does for the HTTP connector (this is an optimization), so add support for the
  negative values.

Modified:
    tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java

Modified: tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java?view=diff&rev=485456&r1=485455&r2=485456
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java Sun Dec 10 17:32:05 2006
@@ -90,10 +90,11 @@
         responseHeaderMessage = new AjpMessage(packetSize);
         bodyMessage = new AjpMessage(packetSize);
         
-        if (endpoint.getFirstReadTimeout() > 0) {
-            readTimeout = endpoint.getFirstReadTimeout() * 1000;
-        } else {
+        readTimeout = endpoint.getFirstReadTimeout() * 1000;
+        if (readTimeout == 0) {
             readTimeout = 100 * 1000;
+        } else if (readTimeout < 0) {
+            readTimeout = -1;
         }
 
         // Allocate input and output buffers
@@ -1024,8 +1025,9 @@
             inputBuffer.limit(inputBuffer.position());
             inputBuffer.position(0);
         }
+        int nRead;
         while (inputBuffer.remaining() < n) {
-            int nRead = Socket.recvbb
+            nRead = Socket.recvbb
                 (socket, inputBuffer.limit(),
                         inputBuffer.capacity() - inputBuffer.limit());
             if (nRead > 0) {
@@ -1056,10 +1058,17 @@
             inputBuffer.limit(inputBuffer.position());
             inputBuffer.position(0);
         }
+        int nRead;
         while (inputBuffer.remaining() < n) {
-            int nRead = Socket.recvbbt
-                (socket, inputBuffer.limit(),
+            if (readTimeout > 0) {
+                nRead = Socket.recvbbt
+                    (socket, inputBuffer.limit(),
                         inputBuffer.capacity() - inputBuffer.limit(), readTimeout);
+            } else {
+                nRead = Socket.recvbb
+                    (socket, inputBuffer.limit(),
+                        inputBuffer.capacity() - inputBuffer.limit());
+            }
             if (nRead > 0) {
                 inputBuffer.limit(inputBuffer.limit() + nRead);
             } else {
@@ -1193,7 +1202,7 @@
         throws IOException {
         if (outputBuffer.position() > 0) {
             if (Socket.sendbb(socket, 0, outputBuffer.position()) < 0) {
-                throw new IOException();
+                throw new IOException(sm.getString("ajpprocessor.failedsend"));
             }
             outputBuffer.clear();
         }



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