Author: violetagg Date: Sat Sep 10 18:28:37 2016 New Revision: 1760200 URL: http://svn.apache.org/viewvc?rev=1760200&view=rev Log: Do not flip the buffer let the caller to flip it.
Modified: tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java Modified: tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java?rev=1760200&r1=1760199&r2=1760200&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java Sat Sep 10 18:28:37 2016 @@ -2310,7 +2310,6 @@ public class AprEndpoint extends Abstrac public int read(boolean block, ByteBuffer to) throws IOException { int nRead = populateReadBuffer(to); if (nRead > 0) { - to.flip(); return nRead; /* * Since more bytes may have arrived since the buffer was last @@ -2326,7 +2325,6 @@ public class AprEndpoint extends Abstrac if (to.isDirect() && to.remaining() >= limit) { to.limit(to.position() + limit); nRead = fillReadBuffer(block, to); - to.flip(); } else { // Fill the read buffer as best we can. nRead = fillReadBuffer(block); @@ -2335,7 +2333,6 @@ public class AprEndpoint extends Abstrac // data that was just read if (nRead > 0) { nRead = populateReadBuffer(to); - to.flip(); } } return nRead; Modified: tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java?rev=1760200&r1=1760199&r2=1760200&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java Sat Sep 10 18:28:37 2016 @@ -899,7 +899,6 @@ public class Nio2Endpoint extends Abstra // don't want to trigger another read since if there is no // more data to read and this request takes a while to // process the read will timeout triggering an error. - to.flip(); readPending.release(); return nRead; } @@ -910,7 +909,6 @@ public class Nio2Endpoint extends Abstra if (block && to.remaining() >= limit) { to.limit(to.position() + limit); nRead = fillReadBuffer(block, to); - to.flip(); } else { // Fill the read buffer as best we can. nRead = fillReadBuffer(block); @@ -919,7 +917,6 @@ public class Nio2Endpoint extends Abstra // data that was just read if (nRead > 0) { nRead = populateReadBuffer(to); - to.flip(); } else if (nRead == 0 && !block) { readInterest = true; } 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=1760200&r1=1760199&r2=1760200&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java Sat Sep 10 18:28:37 2016 @@ -1165,7 +1165,6 @@ public class NioEndpoint extends Abstrac public int read(boolean block, ByteBuffer to) throws IOException { int nRead = populateReadBuffer(to); if (nRead > 0) { - to.flip(); return nRead; /* * Since more bytes may have arrived since the buffer was last @@ -1182,7 +1181,6 @@ public class NioEndpoint extends Abstrac to.limit(to.position() + limit); nRead = fillReadBuffer(block, to); updateLastRead(); - to.flip(); } else { // Fill the read buffer as best we can. nRead = fillReadBuffer(block); @@ -1192,7 +1190,6 @@ public class NioEndpoint extends Abstrac // data that was just read if (nRead > 0) { nRead = populateReadBuffer(to); - to.flip(); } } return nRead; --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org