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


The following commit(s) were added to refs/heads/main by this push:
     new 8f9ccc9a75 Refactor. Simplify. Don't need two fields tracking the same 
value.
8f9ccc9a75 is described below

commit 8f9ccc9a75b8c277148aa9c0b8740f0db7f563fc
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Tue Oct 1 08:13:33 2024 +0100

    Refactor. Simplify. Don't need two fields tracking the same value.
---
 java/org/apache/coyote/http2/Http2UpgradeHandler.java | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/java/org/apache/coyote/http2/Http2UpgradeHandler.java 
b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
index f01678c455..22b4f37849 100644
--- a/java/org/apache/coyote/http2/Http2UpgradeHandler.java
+++ b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
@@ -118,7 +118,6 @@ class Http2UpgradeHandler extends AbstractStream implements 
InternalHttpUpgradeH
 
     private final ConcurrentNavigableMap<Integer,AbstractNonZeroStream> 
streams = new ConcurrentSkipListMap<>();
     protected final AtomicInteger activeRemoteStreamCount = new 
AtomicInteger(0);
-    private volatile int maxActiveRemoteStreamId = 0;
     private volatile int maxProcessedStreamId;
     private final PingManager pingManager = getPingManager();
     private volatile int newStreamsSinceLastPrune = 0;
@@ -176,7 +175,6 @@ class Http2UpgradeHandler extends AbstractStream implements 
InternalHttpUpgradeH
             Integer key = Integer.valueOf(1);
             Stream stream = new Stream(key, this, coyoteRequest);
             streams.put(key, stream);
-            maxActiveRemoteStreamId = 0;
             activeRemoteStreamCount.set(1);
             maxProcessedStreamId = 1;
         }
@@ -1537,14 +1535,13 @@ class Http2UpgradeHandler extends AbstractStream 
implements InternalHttpUpgradeH
             checkPauseState();
 
             if (connectionState.get().isNewStreamAllowed()) {
-                if (streamId > maxActiveRemoteStreamId) {
+                if (streamId > maxProcessedStreamId) {
                     stream = createRemoteStream(streamId);
                     activeRemoteStreamCount.incrementAndGet();
-                    maxActiveRemoteStreamId = streamId;
                 } else {
                     // ID for new stream must always be greater than any 
previous stream
                     throw new 
ConnectionException(sm.getString("upgradeHandler.stream.old", 
Integer.valueOf(streamId),
-                            Integer.valueOf(maxActiveRemoteStreamId)), 
Http2Error.PROTOCOL_ERROR);
+                            Integer.valueOf(maxProcessedStreamId)), 
Http2Error.PROTOCOL_ERROR);
                 }
             } else {
                 if (log.isTraceEnabled()) {


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

Reply via email to