tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Funk <funk...@joedog.org>
Subject Re: svn commit: r375582 - in /tomcat/connectors/trunk: http11/src/java/org/apache/coyote/http11/InternalAprOutputBuffer.java jk/java/org/apache/coyote/ajp/AjpAprProcessor.java
Date Tue, 07 Feb 2006 14:24:02 GMT
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

remm@apache.org 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: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message