Commit ee158fb0 authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa

Add nghttp2_session_{set,get}_next_stream_id API function

parent 280c9dfc
......@@ -2435,6 +2435,32 @@ int nghttp2_session_terminate_session2(nghttp2_session *session,
uint32_t nghttp2_session_get_remote_settings(nghttp2_session *session,
nghttp2_settings_id id);
/**
* @function
*
* Tells the |session| that next stream ID is |next_stream_id|. The
* |next_stream_id| must be equal or greater than the value returned
* by `nghttp2_session_get_next_stream_id()`.
*
* This function returns 0 if it succeeds, or one of the following
* negative error codes:
*
* :enum:`NGHTTP2_ERR_INVALID_ARGUMENT`
* The |next_stream_id| is strictly less than the value
* `nghttp2_session_get_next_stream_id()` returns.
*/
int nghttp2_session_set_next_stream_id(nghttp2_session *session,
int32_t next_stream_id);
/**
* @function
*
* Returns the next outgoing stream ID. Notice that return type is
* uint32_t. If we run out of stream ID for this session, this
* function returns 1 << 31.
*/
uint32_t nghttp2_session_get_next_stream_id(nghttp2_session *session);
/**
* @function
*
......
......@@ -6158,3 +6158,18 @@ int nghttp2_session_consume(nghttp2_session *session, int32_t stream_id,
return 0;
}
int nghttp2_session_set_next_stream_id(nghttp2_session *session,
int32_t next_stream_id) {
if (next_stream_id < 0 ||
session->next_stream_id > (uint32_t)next_stream_id) {
return NGHTTP2_ERR_INVALID_ARGUMENT;
}
session->next_stream_id = next_stream_id;
return 0;
}
uint32_t nghttp2_session_get_next_stream_id(nghttp2_session *session) {
return session->next_stream_id;
}
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