tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1682990 - /tomcat/trunk/java/org/apache/coyote/http2/Stream.java
Date Mon, 01 Jun 2015 20:12:37 GMT
Author: markt
Date: Mon Jun  1 20:12:37 2015
New Revision: 1682990

URL: http://svn.apache.org/r1682990
Log:
If a write fills the buffer exactly, flush shouldn't empty it. It might be the last write
of the response and if we flush we'll need to send an empty data frame later with end of stream
set rather than setting end of stream on the frame that sends the full buffer.

Modified:
    tomcat/trunk/java/org/apache/coyote/http2/Stream.java

Modified: tomcat/trunk/java/org/apache/coyote/http2/Stream.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http2/Stream.java?rev=1682990&r1=1682989&r2=1682990&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http2/Stream.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http2/Stream.java Mon Jun  1 20:12:37 2015
@@ -243,7 +243,9 @@ public class Stream extends AbstractStre
                 buffer.put(chunk.getBytes(), chunk.getOffset() + offset, thisTime);
                 offset += thisTime;
                 len -= thisTime;
-                if (!buffer.hasRemaining()) {
+                if (len > 0 && !buffer.hasRemaining()) {
+                    // Only flush if we have more data to write and the buffer
+                    // is full
                     flush();
                 }
             }



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message