This is an automated email from the ASF dual-hosted git repository. remm 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 be535eefed Refactor decrement using a common method be535eefed is described below commit be535eefeda3754344092da6f30bb9bedacb582d Author: remm <r...@apache.org> AuthorDate: Thu Oct 19 14:50:05 2023 +0200 Refactor decrement using a common method --- .../org/apache/coyote/http2/Http2AsyncUpgradeHandler.java | 2 +- java/org/apache/coyote/http2/Http2UpgradeHandler.java | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java b/java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java index 138529c706..aeebade21b 100644 --- a/java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java +++ b/java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java @@ -157,7 +157,7 @@ public class Http2AsyncUpgradeHandler extends Http2UpgradeHandler { boolean active = state.isActive(); state.sendReset(); if (active) { - activeRemoteStreamCount.decrementAndGet(); + decrementActiveRemoteStreamCount(); } } diff --git a/java/org/apache/coyote/http2/Http2UpgradeHandler.java b/java/org/apache/coyote/http2/Http2UpgradeHandler.java index af29ff3056..c38b3d9807 100644 --- a/java/org/apache/coyote/http2/Http2UpgradeHandler.java +++ b/java/org/apache/coyote/http2/Http2UpgradeHandler.java @@ -290,6 +290,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) { @@ -593,7 +598,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); @@ -820,7 +825,7 @@ class Http2UpgradeHandler extends AbstractStream implements InternalHttpUpgradeH protected void sentEndOfStream(Stream stream) { stream.sentEndOfStream(); if (!stream.isActive()) { - setConnectionTimeoutForStreamCount(activeRemoteStreamCount.decrementAndGet()); + decrementActiveRemoteStreamCount(); } } @@ -1573,7 +1578,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( @@ -1617,7 +1622,7 @@ class Http2UpgradeHandler extends AbstractStream implements InternalHttpUpgradeH private void receivedEndOfStream(Stream stream) throws ConnectionException { stream.receivedEndOfStream(); if (!stream.isActive()) { - setConnectionTimeoutForStreamCount(activeRemoteStreamCount.decrementAndGet()); + decrementActiveRemoteStreamCount(); } } @@ -1643,7 +1648,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