Fixed update of stream closed status in case of data frames.
It was possible that a client sent a data frame with close=true, but the half close of the stream was delayed until after all the data bytes were sent. The server received the data bytes and sent a reply with close=true that could have been processed before the stream was actually half closed by the data frame delayed update, and this generated a race condition. Now the close status is updated before sending the data (like all other frames), but the stream is removed only when data has been fully sent.
This commit is contained in:
parent
4cbca7a664
commit
b8a5d9062f
|
@ -718,7 +718,6 @@ public class StandardSession implements ISession, Parser.Listener, ISession.Cont
|
|||
}
|
||||
else
|
||||
{
|
||||
stream.updateCloseState(data.isClose());
|
||||
if (stream.isClosed())
|
||||
removeStream(stream);
|
||||
}
|
||||
|
|
|
@ -247,9 +247,7 @@ public class StandardStream implements IStream
|
|||
@Override
|
||||
public void data(DataInfo dataInfo)
|
||||
{
|
||||
// We do not update the close state here, because the dataInfo may
|
||||
// generate several frames and in the middle we may receive window
|
||||
// updates, so we need the stream to update the window size
|
||||
updateCloseState(dataInfo.isClose());
|
||||
session.data(this, dataInfo);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue