mirror of
https://github.com/nghttp2/nghttp2.git
synced 2025-12-10 03:58:53 +08:00
Add nghttp2_session_request_allowed() API function
This function is useful for the client application to know that there is a chance that request can be sent. If this function returns 0, there is zero chance to make a request. This commit also set error_code passed to nghttp2_on_stream_close_callback to NGHTTP2_REFUSED_STREAM if request is not sent.
This commit is contained in:
@@ -3479,6 +3479,23 @@ NGHTTP2_EXTERN int nghttp2_submit_goaway(nghttp2_session *session,
|
||||
NGHTTP2_EXTERN int32_t
|
||||
nghttp2_session_get_last_proc_stream_id(nghttp2_session *session);
|
||||
|
||||
/**
|
||||
* @function
|
||||
*
|
||||
* Returns nonzero if new request can be sent from local endpoint.
|
||||
*
|
||||
* This function return 0 if request is not allowed for this session.
|
||||
* There are several reasons why request is not allowed. Some of the
|
||||
* reasons are: session is server; stream ID has been spent; GOAWAY
|
||||
* has been sent or received.
|
||||
*
|
||||
* The application can call `nghttp2_submit_request()` without
|
||||
* consulting this function. In that case, `nghttp2_submit_request()`
|
||||
* may return error. Or, request is failed to sent, and
|
||||
* :type:`nghttp2_on_stream_close_callback` is called.
|
||||
*/
|
||||
NGHTTP2_EXTERN int nghttp2_session_request_allowed(nghttp2_session *session);
|
||||
|
||||
/**
|
||||
* @function
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user