Is it possible for Socket.sendbb to return 0? If so, on what conditions?
(Trying to prevent an infinite loop)
[This happened to me with a jk bug in the past (tomcat 4.0 and an older
version of jk) during a read where tomcat was assuming one thing and apache
was assuming something else. (Can't remember the specifics) ]
-Tim
[EMAIL PROTECTED] wrote:
Author: remm
Date: Tue Feb 7 03:47:20 2006
New Revision: 375582
URL: http://svn.apache.org/viewcvs?rev=375582&view=rev
Log:
- 38464: Fix incorrect usage of sendbb method, which can in some cases do
incomplete writes.
Let me know if there are still problems.
- Note: for AJP, the fix is there just-in-case, as it is apparently impossible
to get in this
situation.
Modified:
tomcat/connectors/trunk/http11/src/java/org/apache/coyote/http11/InternalAprOutputBuffer.java
URL:
http://svn.apache.org/viewcvs/tomcat/connectors/trunk/http11/src/java/org/apache/coyote/http11/InternalAprOutputBuffer.java?rev=375582&r1=375581&r2=375582&view=diff
==============================================================================
---
tomcat/connectors/trunk/http11/src/java/org/apache/coyote/http11/InternalAprOutputBuffer.java
(original)
+++
tomcat/connectors/trunk/http11/src/java/org/apache/coyote/http11/InternalAprOutputBuffer.java
Tue Feb 7 03:47:20 2006
@@ -695,9 +695,14 @@
protected void flushBuffer()
throws IOException {
if (bbuf.position() > 0) {
- if (Socket.sendbb(socket, 0, bbuf.position()) < 0) {
- throw new IOException(sm.getString("iib.failedwrite"));
- }
+ int i = 0;
+ int n = 0;
+ do {
+ if ((n = Socket.sendbb(socket, i, bbuf.position())) < 0) {
+ throw new IOException();
+ }
+ i += n;
+ } while (i < bbuf.position());
bbuf.clear();
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]