Add int return value to on_frame_send_callback
This commit is contained in:
parent
a51cdaacfc
commit
d4852b0f11
|
@ -863,8 +863,13 @@ typedef int (*nghttp2_before_frame_send_callback)
|
|||
* @functypedef
|
||||
*
|
||||
* Callback function invoked after the non-DATA frame |frame| is sent.
|
||||
*
|
||||
* 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_on_frame_send_callback)
|
||||
typedef int (*nghttp2_on_frame_send_callback)
|
||||
(nghttp2_session *session, nghttp2_frame *frame, void *user_data);
|
||||
|
||||
/**
|
||||
|
|
|
@ -1259,8 +1259,10 @@ static int nghttp2_session_after_frame_sent(nghttp2_session *session)
|
|||
nghttp2_frame *frame;
|
||||
frame = nghttp2_outbound_item_get_ctrl_frame(session->aob.item);
|
||||
if(session->callbacks.on_frame_send_callback) {
|
||||
session->callbacks.on_frame_send_callback(session, frame,
|
||||
session->user_data);
|
||||
if(session->callbacks.on_frame_send_callback(session, frame,
|
||||
session->user_data) != 0) {
|
||||
return NGHTTP2_ERR_CALLBACK_FAILURE;
|
||||
}
|
||||
}
|
||||
switch(frame->hd.type) {
|
||||
case NGHTTP2_HEADERS: {
|
||||
|
|
|
@ -739,7 +739,7 @@ void htdocs_on_request_recv_callback
|
|||
}
|
||||
|
||||
namespace {
|
||||
void hd_on_frame_send_callback
|
||||
int hd_on_frame_send_callback
|
||||
(nghttp2_session *session, nghttp2_frame *frame,
|
||||
void *user_data)
|
||||
{
|
||||
|
@ -748,6 +748,7 @@ void hd_on_frame_send_callback
|
|||
print_session_id(hd->session_id());
|
||||
on_frame_send_callback(session, frame, user_data);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
|
|
|
@ -389,13 +389,14 @@ void on_unknown_frame_recv_callback(nghttp2_session *session,
|
|||
fflush(stdout);
|
||||
}
|
||||
|
||||
void on_frame_send_callback
|
||||
int on_frame_send_callback
|
||||
(nghttp2_session *session, nghttp2_frame *frame, void *user_data)
|
||||
{
|
||||
print_timer();
|
||||
printf(" send ");
|
||||
print_frame(PRINT_SEND, frame);
|
||||
fflush(stdout);
|
||||
return 0;
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
|
|
@ -61,7 +61,7 @@ void on_unknown_frame_recv_callback(nghttp2_session *session,
|
|||
size_t payloadlen,
|
||||
void *user_data);
|
||||
|
||||
void on_frame_send_callback
|
||||
int on_frame_send_callback
|
||||
(nghttp2_session *session, nghttp2_frame *frame, void *user_data);
|
||||
|
||||
int on_data_recv_callback
|
||||
|
|
|
@ -978,7 +978,7 @@ void check_stream_id(nghttp2_session *session, int32_t stream_id,
|
|||
}
|
||||
} // namespace
|
||||
|
||||
void on_frame_send_callback2
|
||||
int on_frame_send_callback2
|
||||
(nghttp2_session *session, nghttp2_frame *frame, void *user_data)
|
||||
{
|
||||
if(frame->hd.type == NGHTTP2_HEADERS &&
|
||||
|
@ -988,6 +988,7 @@ void on_frame_send_callback2
|
|||
if(config.verbose) {
|
||||
on_frame_send_callback(session, frame, user_data);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void check_response_header
|
||||
|
|
|
@ -145,13 +145,14 @@ static int on_invalid_frame_recv_callback(nghttp2_session *session,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void on_frame_send_callback(nghttp2_session *session,
|
||||
nghttp2_frame *frame,
|
||||
void *user_data)
|
||||
static int on_frame_send_callback(nghttp2_session *session,
|
||||
nghttp2_frame *frame,
|
||||
void *user_data)
|
||||
{
|
||||
my_user_data *ud = (my_user_data*)user_data;
|
||||
++ud->frame_send_cb_called;
|
||||
ud->sent_frame_type = frame->hd.type;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void on_frame_not_send_callback(nghttp2_session *session,
|
||||
|
|
Loading…
Reference in New Issue