Reviewed handling of the last stream id.

Now the last stream id is updated when a SYN is received, as the spec states.
This commit is contained in:
Simone Bordet 2012-06-08 10:13:18 +02:00
parent 7f39b8b7a4
commit 8894cdc31d
1 changed files with 3 additions and 5 deletions

View File

@ -400,7 +400,6 @@ public class StandardSession implements ISession, Parser.Listener, Handler<Stand
};
flowControlStrategy.onDataReceived(this, stream, dataInfo);
stream.process(dataInfo);
updateLastStreamId(stream);
if (stream.isClosed())
removeStream(stream);
}
@ -430,6 +429,8 @@ public class StandardSession implements ISession, Parser.Listener, Handler<Stand
private void processSyn(SessionFrameListener listener, IStream stream, SynStreamFrame frame)
{
stream.process(frame);
// Update the last stream id before calling the application (which may send a GO_AWAY)
updateLastStreamId(stream);
SynInfo synInfo = new SynInfo(frame.getHeaders(),frame.isClose(),frame.getPriority());
StreamFrameListener streamListener = notifyOnSyn(listener,stream,synInfo);
stream.setStreamFrameListener(streamListener);
@ -801,9 +802,6 @@ public class StandardSession implements ISession, Parser.Listener, Handler<Stand
{
try
{
if (stream != null)
updateLastStreamId(stream);
// Synchronization is necessary, since we may have concurrent replies
// and those needs to be generated and enqueued atomically in order
// to maintain a correct compression context
@ -831,7 +829,7 @@ public class StandardSession implements ISession, Parser.Listener, Handler<Stand
private void updateLastStreamId(IStream stream)
{
int streamId = stream.getId();
if (stream.isClosed() && streamId % 2 != streamIds.get() % 2)
if (streamId % 2 != streamIds.get() % 2)
Atomics.updateMax(lastStreamId, streamId);
}