diff --git a/jetty-http2/http2-http-client-transport/src/main/java/org/eclipse/jetty/http2/client/http/HttpClientTransportOverHTTP2.java b/jetty-http2/http2-http-client-transport/src/main/java/org/eclipse/jetty/http2/client/http/HttpClientTransportOverHTTP2.java index 6e2adcb1f17..c273aa4bb9e 100644 --- a/jetty-http2/http2-http-client-transport/src/main/java/org/eclipse/jetty/http2/client/http/HttpClientTransportOverHTTP2.java +++ b/jetty-http2/http2-http-client-transport/src/main/java/org/eclipse/jetty/http2/client/http/HttpClientTransportOverHTTP2.java @@ -168,7 +168,7 @@ public class HttpClientTransportOverHTTP2 extends ContainerLifeCycle implements @Override public void onFailure(Session session, Throwable failure) { - connection.abort(failure); + connection.close(failure); } } } diff --git a/jetty-http2/http2-http-client-transport/src/main/java/org/eclipse/jetty/http2/client/http/HttpConnectionOverHTTP2.java b/jetty-http2/http2-http-client-transport/src/main/java/org/eclipse/jetty/http2/client/http/HttpConnectionOverHTTP2.java index 98bff3286a1..f166728f772 100644 --- a/jetty-http2/http2-http-client-transport/src/main/java/org/eclipse/jetty/http2/client/http/HttpConnectionOverHTTP2.java +++ b/jetty-http2/http2-http-client-transport/src/main/java/org/eclipse/jetty/http2/client/http/HttpConnectionOverHTTP2.java @@ -61,15 +61,20 @@ public class HttpConnectionOverHTTP2 extends HttpConnection @Override public void close() + { + close(new AsynchronousCloseException()); + } + + protected void close(Throwable failure) { // First close then abort, to be sure that the connection cannot be reused // from an onFailure() handler or by blocking code waiting for completion. getHttpDestination().close(this); session.close(ErrorCode.NO_ERROR.code, null, Callback.NOOP); - abort(new AsynchronousCloseException()); + abort(failure); } - protected void abort(Throwable failure) + private void abort(Throwable failure) { for (HttpChannel channel : channels) {