Commit c12b6bc3 authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa

Call on_stream_close_callback for a stream in reserved state

This is useful because application may allocate resources for it and
wants to free the resources if they are not used anymore.
parent 58da463a
......@@ -875,19 +875,16 @@ int nghttp2_session_close_stream(nghttp2_session *session, int32_t stream_id,
may be PROTOCOL_ERROR, but without notifying stream closure will
hang the stream in a local endpoint.
*/
/* TODO Should on_stream_close_callback be called against
NGHTTP2_STREAM_RESERVED? It is actually not opened yet.
Maybe we should call callback in this case. */
if(stream->state != NGHTTP2_STREAM_RESERVED) {
if(session->callbacks.on_stream_close_callback) {
if(session->callbacks.on_stream_close_callback
(session, stream_id,
error_code,
session->user_data) != 0) {
return NGHTTP2_ERR_CALLBACK_FAILURE;
}
if(session->callbacks.on_stream_close_callback) {
if(session->callbacks.on_stream_close_callback
(session, stream_id, error_code, session->user_data) != 0) {
return NGHTTP2_ERR_CALLBACK_FAILURE;
}
}
if(stream->state != NGHTTP2_STREAM_RESERVED) {
if(nghttp2_session_is_my_stream_id(session, stream_id)) {
--session->num_outgoing_streams;
} else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment