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 2015/02/24 10:53:57 UTC
svn commit: r1661877 -
/tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
Author: markt
Date: Tue Feb 24 09:53:57 2015
New Revision: 1661877
URL: http://svn.apache.org/r1661877
Log:
Remove an (unproven) optimisation that didn't handle end-of-stream correctly and triggered at least one failure in the unit tests.
Modified:
tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
Modified: tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java?rev=1661877&r1=1661876&r2=1661877&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java Tue Feb 24 09:53:57 2015
@@ -1419,14 +1419,18 @@ public class NioEndpoint extends Abstrac
int newOffset = off;
if (remaining > 0) {
readBuffer.get(b, off, remaining);
- leftToWrite -= remaining;
- newOffset += remaining;
+ return remaining;
+ /*
+ * Since more bytes may have arrived since the buffer was last
+ * filled, it is an option at this point to perform a
+ * non-blocking read. However correctly handling the case if
+ * that read returns end of stream adds complexity. Therefore,
+ * at the moment, the preference is for simplicity.
+ */
}
- // Fill the read buffer as best we can. Only do a blocking read if
- // the current read is blocking AND there wasn't any data left over
- // in the read buffer.
- int nRead = fillReadBuffer(block && remaining == 0);
+ // Fill the read buffer as best we can.
+ int nRead = fillReadBuffer(block);
// Full as much of the remaining byte array as possible with the
// data that was just read
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org