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/09/13 16:05:11 UTC

[tomcat] 03/03: Remove clear whole backlog shortcut

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

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

commit dbd137f142385fe2db21f72a04e8a9a789f92ae3
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Mon Sep 13 17:04:52 2021 +0100

    Remove clear whole backlog shortcut
---
 .../apache/coyote/http2/Http2UpgradeHandler.java   | 28 ++++++++--------------
 1 file changed, 10 insertions(+), 18 deletions(-)

diff --git a/java/org/apache/coyote/http2/Http2UpgradeHandler.java b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
index b45dad0..ebd79b6 100644
--- a/java/org/apache/coyote/http2/Http2UpgradeHandler.java
+++ b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
@@ -1024,27 +1024,19 @@ class Http2UpgradeHandler extends AbstractStream implements InternalHttpUpgradeH
 
     private synchronized Set<AbstractStream> releaseBackLog(int increment) {
         Set<AbstractStream> result = new HashSet<>();
-        if (backLogSize < increment) {
-            // Can clear the whole backlog
-            result.addAll(backLogStreams);
-            backLogStreams.clear();
-            backLogSize = 0;
-        } else {
-            int leftToAllocate = increment;
-            while (leftToAllocate > 0) {
-                leftToAllocate = allocate(this, leftToAllocate);
-            }
-            for (AbstractStream stream : backLogStreams) {
-                int allocation = stream.getUnusedAllocation();
-                if (allocation > 0) {
-                    backLogSize -= allocation;
-                    if (!stream.isNotifyInProgress()) {
-                        result.add(stream);
-                        stream.startNotify();
-                    }
+
+        int leftToAllocate = allocate(this, increment);
+        for (AbstractStream stream : backLogStreams) {
+            int allocation = stream.getUnusedAllocation();
+            if (allocation > 0) {
+                backLogSize -= allocation;
+                if (!stream.isNotifyInProgress()) {
+                    result.add(stream);
+                    stream.startNotify();
                 }
             }
         }
+
         return result;
     }
 

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