Call on_stream_close_callback for stream in NGHTTP2_STREAM_INITIAL state

We call on_stream_close_callback even if stream->state is
NGHTTP2_STREAM_INITIAL. This will happen while sending request
HEADERS, a local endpoint receives RST_STREAM for that
stream. It may be PROTOCOL_ERROR, but without notifying stream
closure will hang the stream in a local endpoint.
This commit is contained in:
Tatsuhiro Tsujikawa 2013-09-02 23:09:36 +09:00
parent 27c0f76afb
commit a7bd4f33a3
1 changed files with 7 additions and 2 deletions

View File

@ -541,8 +541,13 @@ int nghttp2_session_close_stream(nghttp2_session *session, int32_t stream_id,
{
nghttp2_stream *stream = nghttp2_session_get_stream(session, stream_id);
if(stream) {
if(stream->state != NGHTTP2_STREAM_INITIAL &&
stream->state != NGHTTP2_STREAM_RESERVED &&
/* We call on_stream_close_callback even if stream->state is
NGHTTP2_STREAM_INITIAL. This will happen while sending request
HEADERS, a local endpoint receives RST_STREAM for that
stream. It may be PROTOCOL_ERROR, but without notifying stream
closure will hang the stream in a local endpoint.
*/
if(stream->state != NGHTTP2_STREAM_RESERVED &&
/* TODO Should on_stream_close_callback be called against
NGHTTP2_STREAM_RESERVED? It is actually not opened yet. */
session->callbacks.on_stream_close_callback) {