in src/main/java/com/twitter/whiskey/net/SpdySession.java [296:331]
public void readSynStreamFrame(int streamId, int associatedToStreamId, byte priority, boolean last, boolean unidirectional) {
/*
* SPDY SYN_STREAM frame processing requirements:
*
* If an endpoint receives a SYN_STREAM with a Stream-ID that is less than
* any previously received SYN_STREAM, it must issue a session error with
* the status PROTOCOL_ERROR.
*
* If an endpoint receives multiple SYN_STREAM frames with the same active
* Stream-ID, it must issue a stream error with the status code PROTOCOL_ERROR.
*
* The recipient can reject a stream by sending a stream error with the
* status code REFUSED_STREAM.
*/
if (streamId <= lastGoodStreamId) {
sendRstStream(streamId, SPDY_STREAM_PROTOCOL_ERROR);
return;
}
if (receivedGoAwayFrame || activeStreams.getRemoteSize() >= localMaxConcurrentStreams) {
sendRstStream(streamId, SPDY_STREAM_REFUSED_STREAM);
return;
}
final SpdyStream parent = activeStreams.get(associatedToStreamId);
if (parent == null || parent.isClosed()) {
sendRstStream(streamId, SPDY_STREAM_PROTOCOL_ERROR);
}
final SpdyStream stream = new SpdyStream.Pushed(parent, priority);
stream.open(streamId, initialSendWindow, initialReceiveWindow);
lastGoodStreamId = streamId;
activeStreams.add(stream);
}