From 206050df7ff2c8d8126310fdad1654a3204d7db4 Mon Sep 17 00:00:00 2001 From: Simone Bordet Date: Sun, 8 Nov 2020 15:28:38 +0100 Subject: [PATCH] Issue 5310 - Review HTTP/2 GOAWAY handling. Refactored push code in a single place: HTTP2Session.push(). Signed-off-by: Simone Bordet --- .../org/eclipse/jetty/http2/HTTP2Session.java | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/jetty-http2/http2-common/src/main/java/org/eclipse/jetty/http2/HTTP2Session.java b/jetty-http2/http2-common/src/main/java/org/eclipse/jetty/http2/HTTP2Session.java index 015507ecdb6..6c038817946 100644 --- a/jetty-http2/http2-common/src/main/java/org/eclipse/jetty/http2/HTTP2Session.java +++ b/jetty-http2/http2-common/src/main/java/org/eclipse/jetty/http2/HTTP2Session.java @@ -624,7 +624,17 @@ public abstract class HTTP2Session extends ContainerLifeCycle implements ISessio @Override public void push(IStream stream, Promise promise, PushPromiseFrame frame, Stream.Listener listener) { - streamCreator.push(frame, promise, listener); + streamCreator.push(frame, new Promise.Wrapper(promise) + { + @Override + public void succeeded(Stream pushedStream) + { + // Pushed streams are implicitly remotely closed. + // They are closed when sending an end-stream DATA frame. + ((IStream)pushedStream).updateClose(true, CloseState.Event.RECEIVED); + super.succeeded(pushedStream); + } + }, listener); } @Override @@ -1338,13 +1348,6 @@ public abstract class HTTP2Session extends ContainerLifeCycle implements ISessio removeStream(stream); break; } - case PUSH_PROMISE: - { - // Pushed streams are implicitly remotely closed. - // They are closed when sending an end-stream DATA frame. - stream.updateClose(true, CloseState.Event.RECEIVED); - break; - } case GO_AWAY: { // We just sent a GO_AWAY, only shutdown the