You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by na...@locus.apache.org on 2000/11/16 17:59:19 UTC

cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/core OutputBuffer.java

nacho       00/11/16 08:59:18

  Modified:    src/share/org/apache/tomcat/core OutputBuffer.java
  Log:
  Flushing the byte buffer after a flush of char buffer.
  
  Revision  Changes    Path
  1.9       +6 -4      jakarta-tomcat/src/share/org/apache/tomcat/core/OutputBuffer.java
  
  Index: OutputBuffer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/OutputBuffer.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- OutputBuffer.java	2000/11/02 21:44:37	1.8
  +++ OutputBuffer.java	2000/11/16 16:59:18	1.9
  @@ -168,7 +168,6 @@
   	if( debug > 0 ) log("write(b,off,len)");
   	int avail=buf.length - count;
   
  -	bytesWritten += len;
   
   	// fit in buffer, great.
   	if( len <= avail ) {
  @@ -176,6 +175,7 @@
   	  // want to flush now
   	    System.arraycopy(b, off, buf, count, len);
   	    count += len;
  +	    bytesWritten += len;
   	}
   
   	// Optimization:
  @@ -193,7 +193,7 @@
   	    System.arraycopy(b, off, buf, count, avail);
   	    count += avail;
   	    flushBytes();
  -	    
  +
   	    System.arraycopy(b, off+avail, buf, count, len - avail);
   	    count+= len - avail;
   	    bytesWritten += len - avail;
  @@ -202,6 +202,7 @@
   	    // long write - flush the buffer and write the rest
   	    // directly from source
   	    flushBytes();
  +	    bytesWritten += len;
   	    realWrite( req, resp, b, off, len );
   	}
   
  @@ -358,9 +359,10 @@
   
       synchronized public void flush() throws IOException {
           doFlush = true;
  -        if( state==CHAR_STATE )
  +        if( state==CHAR_STATE ){
               flushChars();
  -        else if (state==BYTE_STATE)
  +            flushBytes();
  +        }else if (state==BYTE_STATE)
               flushBytes();
           else if (state==INITIAL_STATE)
               realWrite( req, resp, null, 0, 0 );       // nothing written yet