You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2019/12/27 07:57:20 UTC

[httpcomponents-core] 01/03: Bug-fix: H2 protocol handler to reset all streams unconditionally in case of an unexpected exception and attempt to close the i/o session gracefully if possible

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

olegk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/httpcomponents-core.git

commit b4fbcb14bad95081fe5f6461026ef0d1121a3e5d
Author: Oleg Kalnichevski <ol...@apache.org>
AuthorDate: Wed Dec 25 14:26:51 2019 +0100

    Bug-fix: H2 protocol handler to reset all streams unconditionally in case of an unexpected exception and attempt to close the i/o session gracefully if possible
---
 .../hc/core5/http2/impl/nio/AbstractH2StreamMultiplexer.java       | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/AbstractH2StreamMultiplexer.java b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/AbstractH2StreamMultiplexer.java
index 9f66bd1..91280c3 100644
--- a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/AbstractH2StreamMultiplexer.java
+++ b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/AbstractH2StreamMultiplexer.java
@@ -678,10 +678,7 @@ abstract class AbstractH2StreamMultiplexer implements Identifiable, HttpConnecti
             for (final Iterator<Map.Entry<Integer, H2Stream>> it = streamMap.entrySet().iterator(); it.hasNext(); ) {
                 final Map.Entry<Integer, H2Stream> entry = it.next();
                 final H2Stream stream = entry.getValue();
-                if (stream.isLocalClosed() && (stream.isRemoteClosed() || stream.isLocalReset())) {
-                    stream.reset(cause);
-                }
-                stream.releaseResources();
+                stream.reset(cause);
             }
             streamMap.clear();
             if (!(cause instanceof ConnectionClosedException)) {
@@ -701,7 +698,7 @@ abstract class AbstractH2StreamMultiplexer implements Identifiable, HttpConnecti
             connState = ConnectionHandshake.SHUTDOWN;
         } catch (final IOException ignore) {
         } finally {
-            ioSession.close(CloseMode.IMMEDIATE);
+            ioSession.close(cause instanceof IOException ? CloseMode.IMMEDIATE : CloseMode.GRACEFUL);
         }
     }