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:58:05 UTC
svn commit: r1518158 - in /tomcat/trunk/java/org/apache/coyote/http11:
AbstractInputBuffer.java InternalAprInputBuffer.java
InternalInputBuffer.java InternalNioInputBuffer.java
Author: markt
Date: Wed Aug 28 10:58:05 2013
New Revision: 1518158
URL: http://svn.apache.org/r1518158
Log:
Remove nbRead(). Calls to available() now trigger a call of fill(false) (i.e. non-blocking). This avoids a problem observed on the users list where repeated calls to available() in turn triggered calls to nbRead() that resulted in the buffer being expanded as nbRead() didn't reset pos and lastValid when adding data to what was essentially an empty buffer.
Modified:
tomcat/trunk/java/org/apache/coyote/http11/AbstractInputBuffer.java
tomcat/trunk/java/org/apache/coyote/http11/InternalAprInputBuffer.java
tomcat/trunk/java/org/apache/coyote/http11/InternalInputBuffer.java
tomcat/trunk/java/org/apache/coyote/http11/InternalNioInputBuffer.java
Modified: tomcat/trunk/java/org/apache/coyote/http11/AbstractInputBuffer.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/AbstractInputBuffer.java?rev=1518158&r1=1518157&r2=1518158&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/AbstractInputBuffer.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/AbstractInputBuffer.java Wed Aug 28 10:58:05 2013
@@ -244,12 +244,6 @@ public abstract class AbstractInputBuffe
protected abstract void init(SocketWrapper<S> socketWrapper,
AbstractEndpoint endpoint) throws IOException;
- /**
- * Issues a non blocking read.
- * @return int Number of bytes read
- */
- protected abstract int nbRead() throws IOException;
-
protected abstract Log getLog();
@@ -348,7 +342,8 @@ public abstract class AbstractInputBuffe
}
try {
- available = nbRead();
+ fill(false);
+ available = lastValid - pos;
} catch (IOException ioe) {
if (getLog().isDebugEnabled()) {
getLog().debug(sm.getString("iib.available.readFail"), ioe);
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=1518158&r1=1518157&r2=1518158&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:58:05 2013
@@ -627,32 +627,6 @@ public class InternalAprInputBuffer exte
@Override
- protected int nbRead() throws IOException {
- bbuf.clear();
- int nRead = doReadSocket(false);
-
- if (nRead > 0) {
- bbuf.limit(nRead);
- bbuf.get(buf, pos, nRead);
- lastValid = pos + nRead;
- return nRead;
- } else if (-nRead == Status.EAGAIN) {
- return 0;
- } else if (-nRead == Status.TIMEUP) {
- // 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 0;
- } else {
- throw new IOException(sm.getString("iib.failedread.apr",
- Integer.valueOf(-nRead)));
- }
- }
-
-
- @Override
protected final Log getLog() {
return log;
}
Modified: tomcat/trunk/java/org/apache/coyote/http11/InternalInputBuffer.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/InternalInputBuffer.java?rev=1518158&r1=1518157&r2=1518158&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/InternalInputBuffer.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/InternalInputBuffer.java Wed Aug 28 10:58:05 2013
@@ -553,15 +553,6 @@ public class InternalInputBuffer extends
@Override
- protected int nbRead() throws IOException {
- // If this gets called for BIO need to make caller think there is data
- // to read as BIO always reads whether there is data or not (and blocks
- // until there is data to read).
- return 1;
- }
-
-
- @Override
protected final Log getLog() {
return log;
}
Modified: tomcat/trunk/java/org/apache/coyote/http11/InternalNioInputBuffer.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/InternalNioInputBuffer.java?rev=1518158&r1=1518157&r2=1518158&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/InternalNioInputBuffer.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/InternalNioInputBuffer.java Wed Aug 28 10:58:05 2013
@@ -158,12 +158,6 @@ public class InternalNioInputBuffer exte
// --------------------------------------------------------- Public Methods
@Override
- public int nbRead() throws IOException {
- return readSocket(true,false);
- }
-
-
- @Override
protected final Log getLog() {
return log;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org