[][src]Type Definition libnghttp2_sys::nghttp2_on_stream_close_callback

type nghttp2_on_stream_close_callback = Option<unsafe extern "C" fn(session: *mut nghttp2_session, stream_id: i32, error_code: u32, user_data: *mut c_void) -> c_int>;

@functypedef

Callback function invoked when the stream |stream_id| is closed. The reason of closure is indicated by the |error_code|. The |error_code| is usually one of :enum:nghttp2_error_code, but that is not guaranteed. The stream_user_data, which was specified in nghttp2_submit_request() or nghttp2_submit_headers(), is still available in this function. The |user_data| pointer is the third argument passed in to the call to nghttp2_session_client_new() or nghttp2_session_server_new().

This function is also called for a stream in reserved state.

The implementation of this function must return 0 if it succeeds. If nonzero is returned, it is treated as fatal error and nghttp2_session_recv(), nghttp2_session_mem_recv(), nghttp2_session_send(), and nghttp2_session_mem_send() functions immediately return :enum:NGHTTP2_ERR_CALLBACK_FAILURE.

To set this callback to :type:nghttp2_session_callbacks, use nghttp2_session_callbacks_set_on_stream_close_callback().