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 11:52:54 UTC
svn commit: r1661882 -
/tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
Author: markt
Date: Tue Feb 24 10:52:54 2015
New Revision: 1661882
URL: http://svn.apache.org/r1661882
Log:
Further simplifications
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=1661882&r1=1661881&r2=1661882&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 10:52:54 2015
@@ -1415,8 +1415,6 @@ public class NioEndpoint extends Abstrac
}
// Copy what data there is in the read buffer to the byte array
- int leftToWrite = len;
- int newOffset = off;
if (remaining > 0) {
readBuffer.get(b, off, remaining);
return remaining;
@@ -1436,18 +1434,16 @@ public class NioEndpoint extends Abstrac
// data that was just read
if (nRead > 0) {
socketBufferHandler.configureReadBufferForRead();
- if (nRead > leftToWrite) {
- readBuffer.get(b, newOffset, leftToWrite);
- leftToWrite = 0;
+ if (nRead > len) {
+ readBuffer.get(b, off, len);
+ return len;
} else {
- readBuffer.get(b, newOffset, nRead);
- leftToWrite -= nRead;
+ readBuffer.get(b, off, nRead);
+ return nRead;
}
- } else if (nRead == -1) {
- return -1;
+ } else {
+ return nRead;
}
-
- return len - leftToWrite;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org