in src/main/java/com/twitter/whiskey/net/SpdySession.java [334:364]
public void readSynReplyFrame(int streamId, boolean last) {
/*
* SPDY SYN_REPLY frame processing requirements:
*
* If an endpoint receives multiple SYN_REPLY frames for the same active Stream-ID
* it must issue a stream error with the status code STREAM_IN_USE.
*/
Platform.LOGGER.debug("read SYN_REPLY\n--> Stream-ID = " + streamId + "\n--> Last = " + last);
SpdyStream stream = activeStreams.get(streamId);
// Check if this is a reply for an active stream
if (stream == null) {
sendRstStream(streamId, SPDY_STREAM_INVALID_STREAM);
return;
}
// Check if we have received multiple frames for the same Stream-ID
if (stream.hasReceivedReply()) {
sendRstStream(streamId, SPDY_STREAM_STREAM_IN_USE);
return;
}
active = true;
stream.onReply();
if (last) {
stream.closeRemotely();
// Defer removing stream from activeStreams until we receive headersEnd
}
}