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

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


The following commit(s) were added to refs/heads/8.5.x by this push:
     new fa07aa1efe Refactor decrement using a common method
fa07aa1efe is described below

commit fa07aa1efe6c8c9ab56f05cf098a9a03b2906387
Author: remm <r...@apache.org>
AuthorDate: Thu Oct 19 14:50:05 2023 +0200

    Refactor decrement using a common method
---
 java/org/apache/coyote/http2/Http2UpgradeHandler.java | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/java/org/apache/coyote/http2/Http2UpgradeHandler.java 
b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
index 32298adb01..d449cced90 100644
--- a/java/org/apache/coyote/http2/Http2UpgradeHandler.java
+++ b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
@@ -283,6 +283,11 @@ class Http2UpgradeHandler extends AbstractStream 
implements InternalHttpUpgradeH
     }
 
 
+    protected void decrementActiveRemoteStreamCount() {
+        
setConnectionTimeoutForStreamCount(activeRemoteStreamCount.decrementAndGet());
+    }
+
+
     void processStreamOnContainerThread(StreamProcessor streamProcessor, 
SocketEvent event) {
         StreamRunnable streamRunnable = new StreamRunnable(streamProcessor, 
event);
         if (streamConcurrency == null) {
@@ -586,7 +591,7 @@ class Http2UpgradeHandler extends AbstractStream implements 
InternalHttpUpgradeH
                 boolean active = state.isActive();
                 state.sendReset();
                 if (active) {
-                    activeRemoteStreamCount.decrementAndGet();
+                    decrementActiveRemoteStreamCount();
                 }
             }
             socketWrapper.write(true, rstFrame, 0, rstFrame.length);
@@ -830,7 +835,7 @@ class Http2UpgradeHandler extends AbstractStream implements 
InternalHttpUpgradeH
     protected void sentEndOfStream(Stream stream) {
         stream.sentEndOfStream();
         if (!stream.isActive()) {
-            
setConnectionTimeoutForStreamCount(activeRemoteStreamCount.decrementAndGet());
+            decrementActiveRemoteStreamCount();
         }
     }
 
@@ -1750,7 +1755,7 @@ class Http2UpgradeHandler extends AbstractStream 
implements InternalHttpUpgradeH
                 if (stream.receivedEndOfHeaders()) {
 
                     if (localSettings.getMaxConcurrentStreams() < 
activeRemoteStreamCount.incrementAndGet()) {
-                        
setConnectionTimeoutForStreamCount(activeRemoteStreamCount.decrementAndGet());
+                        decrementActiveRemoteStreamCount();
                         // Ignoring maxConcurrentStreams increases the 
overhead count
                         increaseOverheadCount(FrameType.HEADERS);
                         throw new StreamException(
@@ -1794,7 +1799,7 @@ class Http2UpgradeHandler extends AbstractStream 
implements InternalHttpUpgradeH
     private void receivedEndOfStream(Stream stream) throws ConnectionException 
{
         stream.receivedEndOfStream();
         if (!stream.isActive()) {
-            
setConnectionTimeoutForStreamCount(activeRemoteStreamCount.decrementAndGet());
+            decrementActiveRemoteStreamCount();
         }
     }
 
@@ -1820,7 +1825,7 @@ class Http2UpgradeHandler extends AbstractStream 
implements InternalHttpUpgradeH
             boolean active = stream.isActive();
             stream.receiveReset(errorCode);
             if (active) {
-                activeRemoteStreamCount.decrementAndGet();
+                decrementActiveRemoteStreamCount();
             }
         }
     }


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

Reply via email to