You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2021/07/01 18:07:05 UTC

[tomcat] branch 9.0.x updated: Simplify

This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
     new 0c7ad6f  Simplify
0c7ad6f is described below

commit 0c7ad6fd40d903cae8464e923c10da51764b7254
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Jul 1 19:05:20 2021 +0100

    Simplify
    
    The logic used to obtain connectionReservation and streamReservartion
    means that streamReservation >= connectionReservation
---
 java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java b/java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java
index 13b6300..08ee177 100644
--- a/java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java
+++ b/java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java
@@ -312,7 +312,9 @@ public class Http2AsyncUpgradeHandler extends Http2UpgradeHandler {
             } catch (IOException e) {
                 return SendfileState.ERROR;
             }
-            // Actually perform the write
+
+            // connectionReservation will always be smaller than or the same as
+            // streamReservation
             int frameSize = Integer.min(getMaxFrameSize(), sendfile.connectionReservation);
             boolean finished = (frameSize == sendfile.left) && sendfile.stream.getCoyoteResponse().getTrailerFields() == null;
 
@@ -374,7 +376,10 @@ public class Http2AsyncUpgradeHandler extends Http2UpgradeHandler {
                 failed (e, sendfile);
                 return;
             }
-            int frameSize = Integer.min(getMaxFrameSize(), Integer.min(sendfile.streamReservation, sendfile.connectionReservation));
+
+            // connectionReservation will always be smaller than or the same as
+            // streamReservation
+            int frameSize = Integer.min(getMaxFrameSize(), sendfile.connectionReservation);
             boolean finished = (frameSize == sendfile.left) && sendfile.stream.getCoyoteResponse().getTrailerFields() == null;
 
             // Need to check this now since sending end of stream will change this.

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