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/28 12:45:05 UTC

svn commit: r1518154 - /tomcat/trunk/java/org/apache/coyote/http11/InternalAprInputBuffer.java

Author: markt
Date: Wed Aug 28 10:45:05 2013
New Revision: 1518154

URL: http://svn.apache.org/r1518154
Log:
Handle non-standard OSX behaviour on non-blocking reads that return no data in fill() as well as nbRead()

Modified:
    tomcat/trunk/java/org/apache/coyote/http11/InternalAprInputBuffer.java

Modified: tomcat/trunk/java/org/apache/coyote/http11/InternalAprInputBuffer.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/InternalAprInputBuffer.java?rev=1518154&r1=1518153&r2=1518154&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/InternalAprInputBuffer.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/InternalAprInputBuffer.java Wed Aug 28 10:45:05 2013
@@ -600,7 +600,18 @@ public class InternalAprInputBuffer exte
                 lastValid = pos + nRead;
             } else {
                 if ((-nRead) == Status.ETIMEDOUT || (-nRead) == Status.TIMEUP) {
-                    throw new SocketTimeoutException(sm.getString("iib.readtimeout"));
+                    if (block) {
+                        throw new SocketTimeoutException(
+                                sm.getString("iib.readtimeout"));
+                    } else {
+                        // Attempting to read from the socket when the poller
+                        // has not signalled that there is data to read appears
+                        // to behave like a blocking read with a short timeout
+                        // on OSX rather than like a non-blocking read. If no
+                        // data is read, treat the resulting timeout like a
+                        // non-blocking read that returned no data.
+                        return false;
+                    }
                 } else if (nRead == 0) {
                     // APR_STATUS_IS_EOF, since native 1.1.22
                     return false;



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