Author: remy.maucherat(a)jboss.com
Date: 2008-03-04 10:39:25 -0500 (Tue, 04 Mar 2008)
New Revision: 465
Modified:
trunk/java/org/apache/coyote/http11/InternalAprInputBuffer.java
Log:
- Just in case, handle the case where the result is 0 (for some reason, it can happen).
Modified: trunk/java/org/apache/coyote/http11/InternalAprInputBuffer.java
===================================================================
--- trunk/java/org/apache/coyote/http11/InternalAprInputBuffer.java 2008-03-04 15:38:27
UTC (rev 464)
+++ trunk/java/org/apache/coyote/http11/InternalAprInputBuffer.java 2008-03-04 15:39:25
UTC (rev 465)
@@ -788,20 +788,18 @@
bbuf.limit(nRead);
bbuf.get(buf, pos, nRead);
lastValid = pos + nRead;
- } else if (nRead < 0) {
+ } else if (nRead <= 0) {
if ((-nRead) == Status.ETIMEDOUT || (-nRead) == Status.TIMEUP) {
throw new
SocketTimeoutException(sm.getString("iib.failedread"));
} else if ((-nRead) == Status.EAGAIN && nonBlocking) {
- // FIXME: I don't understand why the result is not nRead = 0
- /* As asynchronous reads are forbidden, this test is not useful
*/
- /*&& (Http11AprProcessor.containerThread.get() ==
Boolean.TRUE)*/
+ // As asynchronous reads are forbidden, this test is not useful
+ // && (Http11AprProcessor.containerThread.get() ==
Boolean.TRUE)
if (available) {
nRead = 0;
} else {
// In this specific situation, perform the read again in blocking
mode (the user is not
// using available and simply wants to read all data)
Socket.optSet(socket, Socket.APR_SO_NONBLOCK, 0);
- // Also use the usual timeout
Socket.timeoutSet(socket, 20000*1000);
nRead = Socket.recvbb(socket, 0, buf.length - lastValid);
Socket.optSet(socket, Socket.APR_SO_NONBLOCK, 1);
@@ -810,7 +808,7 @@
bbuf.limit(nRead);
bbuf.get(buf, pos, nRead);
lastValid = pos + nRead;
- } else if (nRead < 0) {
+ } else if (nRead <= 0) {
if ((-nRead) == Status.ETIMEDOUT || (-nRead) ==
Status.TIMEUP) {
throw new
SocketTimeoutException(sm.getString("iib.failedread"));
} else {
Show replies by date