Author: markt
Date: Mon Mar 9 16:32:43 2015
New Revision: 1665297
URL: http://svn.apache.org/r1665297
Log:
Follow up to r1665062
Callers assume that output() will fully write the data that is passed to it.
Ensure that this is the case when the AJP message size is larger than the
output buffer.
Modified:
tomcat/tc7.0.x/trunk/java/org/apache/coyote/ajp/AjpNioProcessor.java
Modified: tomcat/tc7.0.x/trunk/java/org/apache/coyote/ajp/AjpNioProcessor.java
URL:
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/coyote/ajp/AjpNioProcessor.java?rev=1665297&r1=1665296&r2=1665297&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/coyote/ajp/AjpNioProcessor.java
(original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/coyote/ajp/AjpNioProcessor.java Mon
Mar 9 16:32:43 2015
@@ -302,24 +302,29 @@ public class AjpNioProcessor extends Abs
ByteBuffer writeBuffer =
socketWrapper.getSocket().getBufHandler().getWriteBuffer();
- int toWrite = Math.min(length, writeBuffer.remaining());
- writeBuffer.put(src, offset, toWrite);
-
- writeBuffer.flip();
-
- long writeTimeout = att.getWriteTimeout();
- Selector selector = null;
- try {
- selector = pool.get();
- } catch ( IOException x ) {
- //ignore
- }
- try {
- pool.write(writeBuffer, socketWrapper.getSocket(), selector,
- writeTimeout, true);
- }finally {
- writeBuffer.clear();
- if ( selector != null ) pool.put(selector);
+ int left = length;
+ int written = 0;
+ while (left > 0) {
+ int toWrite = Math.min(left, writeBuffer.remaining());
+ writeBuffer.put(src, offset, toWrite);
+
+ writeBuffer.flip();
+
+ long writeTimeout = att.getWriteTimeout();
+ Selector selector = null;
+ try {
+ selector = pool.get();
+ } catch ( IOException x ) {
+ //ignore
+ }
+ try {
+ written = pool.write(writeBuffer, socketWrapper.getSocket(),
+ selector, writeTimeout, true);
+ } finally {
+ writeBuffer.clear();
+ if ( selector != null ) pool.put(selector);
+ }
+ left -= written;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]