Commit a51cdaac authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa

Add int return value to nghttp2_before_frame_send_callback

parent 544ac9f6
......@@ -850,8 +850,13 @@ typedef int (*nghttp2_on_data_recv_callback)
* HEADERS and PUSH_PROMISE frame (see also
* `nghttp2_session_get_stream_user_data()`), which is not assigned
* 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);
/**
......
......@@ -1496,10 +1496,12 @@ int nghttp2_session_send(nghttp2_session *session)
/* Call before_send callback */
if(item->frame_cat == NGHTTP2_CAT_CTRL &&
session->callbacks.before_frame_send_callback) {
session->callbacks.before_frame_send_callback
if(session->callbacks.before_frame_send_callback
(session,
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;
......
......@@ -945,7 +945,7 @@ int on_data_chunk_recv_callback(nghttp2_session *session,
} // namespace
namespace {
void before_frame_send_callback(nghttp2_session *session,
int before_frame_send_callback(nghttp2_session *session,
nghttp2_frame *frame,
void *user_data)
{
......@@ -956,7 +956,7 @@ void before_frame_send_callback(nghttp2_session *session,
if(!sd || !sd->dconn) {
nghttp2_submit_rst_stream(session, frame->hd.stream_id,
NGHTTP2_CANCEL);
return;
return 0;
}
auto downstream = sd->dconn->get_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);
}
}
return 0;
}
} // namespace
......
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