Issue 5310 - Review HTTP/2 GOAWAY handling.

Refactored push code in a single place: HTTP2Session.push().

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
This commit is contained in:
Simone Bordet 2020-11-08 15:28:38 +01:00
parent 0dc2894002
commit 206050df7f
1 changed files with 11 additions and 8 deletions

View File

@ -624,7 +624,17 @@ public abstract class HTTP2Session extends ContainerLifeCycle implements ISessio
@Override
public void push(IStream stream, Promise<Stream> promise, PushPromiseFrame frame, Stream.Listener listener)
{
streamCreator.push(frame, promise, listener);
streamCreator.push(frame, new Promise.Wrapper<Stream>(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