Add int return value to nghttp2_before_frame_send_callback
This commit is contained in:
parent
544ac9f61f
commit
a51cdaacfc
|
@ -850,8 +850,13 @@ typedef int (*nghttp2_on_data_recv_callback)
|
||||||
* HEADERS and PUSH_PROMISE frame (see also
|
* HEADERS and PUSH_PROMISE frame (see also
|
||||||
* `nghttp2_session_get_stream_user_data()`), which is not assigned
|
* `nghttp2_session_get_stream_user_data()`), which is not assigned
|
||||||
* when it was queued.
|
* when it was queued.
|
||||||
|
*
|
||||||
|
* 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()` and `nghttp2_session_send()` functions
|
||||||
|
* immediately return :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`.
|
||||||
*/
|
*/
|
||||||
typedef void (*nghttp2_before_frame_send_callback)
|
typedef int (*nghttp2_before_frame_send_callback)
|
||||||
(nghttp2_session *session, nghttp2_frame *frame, void *user_data);
|
(nghttp2_session *session, nghttp2_frame *frame, void *user_data);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1496,10 +1496,12 @@ int nghttp2_session_send(nghttp2_session *session)
|
||||||
/* Call before_send callback */
|
/* Call before_send callback */
|
||||||
if(item->frame_cat == NGHTTP2_CAT_CTRL &&
|
if(item->frame_cat == NGHTTP2_CAT_CTRL &&
|
||||||
session->callbacks.before_frame_send_callback) {
|
session->callbacks.before_frame_send_callback) {
|
||||||
session->callbacks.before_frame_send_callback
|
if(session->callbacks.before_frame_send_callback
|
||||||
(session,
|
(session,
|
||||||
nghttp2_outbound_item_get_ctrl_frame(item),
|
nghttp2_outbound_item_get_ctrl_frame(item),
|
||||||
session->user_data);
|
session->user_data) != 0) {
|
||||||
|
return NGHTTP2_ERR_CALLBACK_FAILURE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
data = session->aob.framebuf + session->aob.framebufoff;
|
data = session->aob.framebuf + session->aob.framebufoff;
|
||||||
|
|
|
@ -945,9 +945,9 @@ int on_data_chunk_recv_callback(nghttp2_session *session,
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
void before_frame_send_callback(nghttp2_session *session,
|
int before_frame_send_callback(nghttp2_session *session,
|
||||||
nghttp2_frame *frame,
|
nghttp2_frame *frame,
|
||||||
void *user_data)
|
void *user_data)
|
||||||
{
|
{
|
||||||
if(frame->hd.type == NGHTTP2_HEADERS &&
|
if(frame->hd.type == NGHTTP2_HEADERS &&
|
||||||
frame->headers.cat == NGHTTP2_HCAT_REQUEST) {
|
frame->headers.cat == NGHTTP2_HCAT_REQUEST) {
|
||||||
|
@ -956,7 +956,7 @@ void before_frame_send_callback(nghttp2_session *session,
|
||||||
if(!sd || !sd->dconn) {
|
if(!sd || !sd->dconn) {
|
||||||
nghttp2_submit_rst_stream(session, frame->hd.stream_id,
|
nghttp2_submit_rst_stream(session, frame->hd.stream_id,
|
||||||
NGHTTP2_CANCEL);
|
NGHTTP2_CANCEL);
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
auto downstream = sd->dconn->get_downstream();
|
auto downstream = sd->dconn->get_downstream();
|
||||||
if(downstream) {
|
if(downstream) {
|
||||||
|
@ -965,6 +965,7 @@ void before_frame_send_callback(nghttp2_session *session,
|
||||||
nghttp2_submit_rst_stream(session, frame->hd.stream_id, NGHTTP2_CANCEL);
|
nghttp2_submit_rst_stream(session, frame->hd.stream_id, NGHTTP2_CANCEL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue