Restored first-close-and-remove-then-notify ordering that was changed with the changes for #5310.

This is important in tests that check that streams have been removed from sessions after counting down a latch in the notification.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
This commit is contained in:
Simone Bordet 2020-12-01 12:55:23 +01:00
parent df3a32601a
commit eb00ac2dde
3 changed files with 9 additions and 12 deletions

View File

@ -63,10 +63,9 @@ public class HTTP2ClientSession extends HTTP2Session
else else
{ {
stream.process(frame, Callback.NOOP); stream.process(frame, Callback.NOOP);
boolean closed = stream.updateClose(frame.isEndStream(), CloseState.Event.RECEIVED); if (stream.updateClose(frame.isEndStream(), CloseState.Event.RECEIVED))
notifyHeaders(stream, frame);
if (closed)
removeStream(stream); removeStream(stream);
notifyHeaders(stream, frame);
} }
} }
else else

View File

@ -357,10 +357,10 @@ public class HTTP2Stream extends IdleTimeout implements IStream, Callback, Dumpa
} }
} }
boolean closed = updateClose(frame.isEndStream(), CloseState.Event.RECEIVED); if (updateClose(frame.isEndStream(), CloseState.Event.RECEIVED))
notifyData(this, frame, callback);
if (closed)
session.removeStream(this); session.removeStream(this);
notifyData(this, frame, callback);
} }
private void onReset(ResetFrame frame, Callback callback) private void onReset(ResetFrame frame, Callback callback)

View File

@ -104,11 +104,10 @@ public class HTTP2ServerSession extends HTTP2Session implements ServerParser.Lis
{ {
onStreamOpened(stream); onStreamOpened(stream);
stream.process(frame, Callback.NOOP); stream.process(frame, Callback.NOOP);
boolean closed = stream.updateClose(frame.isEndStream(), CloseState.Event.RECEIVED); if (stream.updateClose(frame.isEndStream(), CloseState.Event.RECEIVED))
removeStream(stream);
Stream.Listener listener = notifyNewStream(stream, frame); Stream.Listener listener = notifyNewStream(stream, frame);
stream.setListener(listener); stream.setListener(listener);
if (closed)
removeStream(stream);
} }
} }
} }
@ -127,10 +126,9 @@ public class HTTP2ServerSession extends HTTP2Session implements ServerParser.Lis
if (stream != null) if (stream != null)
{ {
stream.process(frame, Callback.NOOP); stream.process(frame, Callback.NOOP);
boolean closed = stream.updateClose(frame.isEndStream(), CloseState.Event.RECEIVED); if (stream.updateClose(frame.isEndStream(), CloseState.Event.RECEIVED))
notifyHeaders(stream, frame);
if (closed)
removeStream(stream); removeStream(stream);
notifyHeaders(stream, frame);
} }
else else
{ {