Set FIN bit set in stream when requet DATA frame with FIN bit set is sent.

This commit is contained in:
Tatsuhiro Tsujikawa 2012-01-27 17:22:17 +09:00
parent 7272782f67
commit 29df087ae8
1 changed files with 14 additions and 4 deletions

View File

@ -390,10 +390,20 @@ static int spdylay_session_after_frame_sent(spdylay_session *session)
spdylay_session_close_stream(session, frame->rst_stream.stream_id); spdylay_session_close_stream(session, frame->rst_stream.stream_id);
break; break;
case SPDYLAY_DATA: case SPDYLAY_DATA:
if((frame->data.flags & SPDYLAY_FLAG_FIN) && if(frame->data.flags & SPDYLAY_FLAG_FIN) {
!spdylay_session_is_my_stream_id(session, frame->data.stream_id)) { if(spdylay_session_is_my_stream_id(session, frame->data.stream_id)) {
/* We send all data requested by peer, so close the stream. */ /* This is the last frame of request DATA (e.g., POST in HTTP
spdylay_session_close_stream(session, frame->data.stream_id); term), so set FIN bit set in stream. This also happens when
request HEADERS frame is sent with FIN bit set. */
spdylay_stream *stream =
spdylay_session_get_stream(session, frame->data.stream_id);
if(stream) {
stream->flags |= SPDYLAY_FLAG_FIN;
}
} else {
/* We send all data requested by peer, so close the stream. */
spdylay_session_close_stream(session, frame->data.stream_id);
}
} }
break; break;
}; };