Looking at the implementation in network.c, we can only leave
the loop upon a write error, in which case we return the
APR error (negative) or we've sent more (or the
exact same) as we've decided to send, which must
be positive. So it doesn't look like it, no. In
any case, the inf loop would be in the impl from
what I can see :)
On Feb 7, 2006, at 9:24 AM, Tim Funk wrote:
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]