Close the stream if SYN_REPLY with FIN bit set is received.

This commit is contained in:
Tatsuhiro Tsujikawa 2012-01-27 17:15:24 +09:00
parent beb509ef39
commit 7272782f67
1 changed files with 6 additions and 0 deletions

View File

@ -642,6 +642,12 @@ int spdylay_session_on_syn_reply_received(spdylay_session *session,
stream->state = SPDYLAY_STREAM_OPENED; stream->state = SPDYLAY_STREAM_OPENED;
spdylay_session_call_on_ctrl_frame_received(session, SPDYLAY_SYN_REPLY, spdylay_session_call_on_ctrl_frame_received(session, SPDYLAY_SYN_REPLY,
frame); frame);
if(frame->syn_reply.hd.flags & SPDYLAY_FLAG_FIN) {
/* This is the last frame of this stream, so close the
stream. This also happens when DATA and HEADERS frame
with FIN bit set. */
spdylay_session_close_stream(session, frame->syn_reply.stream_id);
}
} else if(stream->state == SPDYLAY_STREAM_CLOSING) { } else if(stream->state == SPDYLAY_STREAM_CLOSING) {
/* This is race condition. SPDYLAY_STREAM_CLOSING indicates /* This is race condition. SPDYLAY_STREAM_CLOSING indicates
that we queued RST_STREAM but it has not been sent. It will that we queued RST_STREAM but it has not been sent. It will