Add int return value to on_frame_not_send_callback
This commit is contained in:
parent
d4852b0f11
commit
b9d2f9b6b0
|
@ -879,8 +879,13 @@ typedef int (*nghttp2_on_frame_send_callback)
|
||||||
* sent because of the error. The error is indicated by the
|
* sent because of the error. The error is indicated by the
|
||||||
* |lib_error_code|, which is one of the values defined in
|
* |lib_error_code|, which is one of the values defined in
|
||||||
* :type:`nghttp2_error`.
|
* :type:`nghttp2_error`.
|
||||||
|
*
|
||||||
|
* 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_not_send_callback)
|
typedef int (*nghttp2_on_frame_not_send_callback)
|
||||||
(nghttp2_session *session, nghttp2_frame *frame, int lib_error_code,
|
(nghttp2_session *session, nghttp2_frame *frame, int lib_error_code,
|
||||||
void *user_data);
|
void *user_data);
|
||||||
|
|
||||||
|
|
|
@ -1474,8 +1474,10 @@ int nghttp2_session_send(nghttp2_session *session)
|
||||||
it. */
|
it. */
|
||||||
nghttp2_frame *frame = nghttp2_outbound_item_get_ctrl_frame(item);
|
nghttp2_frame *frame = nghttp2_outbound_item_get_ctrl_frame(item);
|
||||||
if(frame->hd.type != NGHTTP2_WINDOW_UPDATE) {
|
if(frame->hd.type != NGHTTP2_WINDOW_UPDATE) {
|
||||||
session->callbacks.on_frame_not_send_callback
|
if(session->callbacks.on_frame_not_send_callback
|
||||||
(session, frame, framebuflen, session->user_data);
|
(session, frame, framebuflen, session->user_data) != 0) {
|
||||||
|
return NGHTTP2_ERR_CALLBACK_FAILURE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
nghttp2_outbound_item_free(item);
|
nghttp2_outbound_item_free(item);
|
||||||
|
|
|
@ -331,9 +331,9 @@ int on_data_chunk_recv_callback(nghttp2_session *session,
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
void on_frame_not_send_callback(nghttp2_session *session,
|
int on_frame_not_send_callback(nghttp2_session *session,
|
||||||
nghttp2_frame *frame,
|
nghttp2_frame *frame,
|
||||||
int lib_error_code, void *user_data)
|
int lib_error_code, void *user_data)
|
||||||
{
|
{
|
||||||
auto upstream = reinterpret_cast<Http2Upstream*>(user_data);
|
auto upstream = reinterpret_cast<Http2Upstream*>(user_data);
|
||||||
ULOG(WARNING, upstream) << "Failed to send control frame type="
|
ULOG(WARNING, upstream) << "Failed to send control frame type="
|
||||||
|
@ -348,6 +348,7 @@ void on_frame_not_send_callback(nghttp2_session *session,
|
||||||
upstream->rst_stream(downstream, NGHTTP2_INTERNAL_ERROR);
|
upstream->rst_stream(downstream, NGHTTP2_INTERNAL_ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
|
|
@ -970,7 +970,7 @@ int before_frame_send_callback(nghttp2_session *session,
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
void on_frame_not_send_callback(nghttp2_session *session,
|
int on_frame_not_send_callback(nghttp2_session *session,
|
||||||
nghttp2_frame *frame,
|
nghttp2_frame *frame,
|
||||||
int lib_error_code, void *user_data)
|
int lib_error_code, void *user_data)
|
||||||
{
|
{
|
||||||
|
@ -986,19 +986,20 @@ void on_frame_not_send_callback(nghttp2_session *session,
|
||||||
auto sd = reinterpret_cast<StreamData*>
|
auto sd = reinterpret_cast<StreamData*>
|
||||||
(nghttp2_session_get_stream_user_data(session, frame->hd.stream_id));
|
(nghttp2_session_get_stream_user_data(session, frame->hd.stream_id));
|
||||||
if(!sd) {
|
if(!sd) {
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
if(sd->dconn) {
|
if(sd->dconn) {
|
||||||
auto downstream = sd->dconn->get_downstream();
|
auto downstream = sd->dconn->get_downstream();
|
||||||
if(!downstream ||
|
if(!downstream ||
|
||||||
downstream->get_downstream_stream_id() != frame->hd.stream_id) {
|
downstream->get_downstream_stream_id() != frame->hd.stream_id) {
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
downstream->set_response_state(Downstream::MSG_RESET);
|
downstream->set_response_state(Downstream::MSG_RESET);
|
||||||
call_downstream_readcb(spdy, downstream);
|
call_downstream_readcb(spdy, downstream);
|
||||||
}
|
}
|
||||||
spdy->remove_stream_data(sd);
|
spdy->remove_stream_data(sd);
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
|
|
@ -155,15 +155,16 @@ static int on_frame_send_callback(nghttp2_session *session,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void on_frame_not_send_callback(nghttp2_session *session,
|
static int on_frame_not_send_callback(nghttp2_session *session,
|
||||||
nghttp2_frame *frame,
|
nghttp2_frame *frame,
|
||||||
int lib_error,
|
int lib_error,
|
||||||
void *user_data)
|
void *user_data)
|
||||||
{
|
{
|
||||||
my_user_data *ud = (my_user_data*)user_data;
|
my_user_data *ud = (my_user_data*)user_data;
|
||||||
++ud->frame_not_send_cb_called;
|
++ud->frame_not_send_cb_called;
|
||||||
ud->not_sent_frame_type = frame->hd.type;
|
ud->not_sent_frame_type = frame->hd.type;
|
||||||
ud->not_sent_error = lib_error;
|
ud->not_sent_error = lib_error;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int on_data_chunk_recv_callback(nghttp2_session *session,
|
static int on_data_chunk_recv_callback(nghttp2_session *session,
|
||||||
|
|
Loading…
Reference in New Issue