Add int return value to nghttp2_on_frame_recv_parse_error_callback
This commit is contained in:
parent
053c444769
commit
db4f519500
|
@ -950,8 +950,13 @@ typedef int (*nghttp2_on_request_recv_callback)
|
|||
* The |payloadlen| is the length of the |payload|. This is the data
|
||||
* after the length field. The |lib_error_code| is one of the error code
|
||||
* defined in :enum:`nghttp2_error` and indicates the 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_recv_parse_error_callback)
|
||||
typedef int (*nghttp2_on_frame_recv_parse_error_callback)
|
||||
(nghttp2_session *session, nghttp2_frame_type type,
|
||||
const uint8_t *head, size_t headlen,
|
||||
const uint8_t *payload, size_t payloadlen,
|
||||
|
|
|
@ -1681,15 +1681,17 @@ static int nghttp2_session_handle_parse_error(nghttp2_session *session,
|
|||
nghttp2_error_code error_code)
|
||||
{
|
||||
if(session->callbacks.on_frame_recv_parse_error_callback) {
|
||||
session->callbacks.on_frame_recv_parse_error_callback
|
||||
(session,
|
||||
type,
|
||||
session->iframe.headbuf,
|
||||
sizeof(session->iframe.headbuf),
|
||||
session->iframe.buf,
|
||||
session->iframe.buflen,
|
||||
lib_error_code,
|
||||
session->user_data);
|
||||
if(session->callbacks.on_frame_recv_parse_error_callback
|
||||
(session,
|
||||
type,
|
||||
session->iframe.headbuf,
|
||||
sizeof(session->iframe.headbuf),
|
||||
session->iframe.buf,
|
||||
session->iframe.buflen,
|
||||
lib_error_code,
|
||||
session->user_data) != 0) {
|
||||
return NGHTTP2_ERR_CALLBACK_FAILURE;
|
||||
}
|
||||
}
|
||||
return nghttp2_session_fail_session(session, error_code);
|
||||
}
|
||||
|
|
|
@ -357,7 +357,7 @@ void dump_header(const uint8_t *head, size_t headlen)
|
|||
}
|
||||
} // namespace
|
||||
|
||||
void on_frame_recv_parse_error_callback(nghttp2_session *session,
|
||||
int on_frame_recv_parse_error_callback(nghttp2_session *session,
|
||||
nghttp2_frame_type type,
|
||||
const uint8_t *head,
|
||||
size_t headlen,
|
||||
|
@ -374,6 +374,7 @@ void on_frame_recv_parse_error_callback(nghttp2_session *session,
|
|||
printf("Error: %s\n", nghttp2_strerror(error_code));
|
||||
dump_header(head, headlen);
|
||||
fflush(stdout);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void on_unknown_frame_recv_callback(nghttp2_session *session,
|
||||
|
|
|
@ -46,7 +46,7 @@ int on_invalid_frame_recv_callback
|
|||
(nghttp2_session *session, nghttp2_frame *frame,
|
||||
nghttp2_error_code error_code, void *user_data);
|
||||
|
||||
void on_frame_recv_parse_error_callback(nghttp2_session *session,
|
||||
int on_frame_recv_parse_error_callback(nghttp2_session *session,
|
||||
nghttp2_frame_type type,
|
||||
const uint8_t *head,
|
||||
size_t headlen,
|
||||
|
|
|
@ -354,12 +354,12 @@ int on_frame_not_send_callback(nghttp2_session *session,
|
|||
} // namespace
|
||||
|
||||
namespace {
|
||||
void on_frame_recv_parse_error_callback(nghttp2_session *session,
|
||||
nghttp2_frame_type type,
|
||||
const uint8_t *head, size_t headlen,
|
||||
const uint8_t *payload,
|
||||
size_t payloadlen, int lib_error_code,
|
||||
void *user_data)
|
||||
int on_frame_recv_parse_error_callback(nghttp2_session *session,
|
||||
nghttp2_frame_type type,
|
||||
const uint8_t *head, size_t headlen,
|
||||
const uint8_t *payload,
|
||||
size_t payloadlen, int lib_error_code,
|
||||
void *user_data)
|
||||
{
|
||||
auto upstream = reinterpret_cast<Http2Upstream*>(user_data);
|
||||
if(LOG_ENABLED(INFO)) {
|
||||
|
@ -368,6 +368,7 @@ void on_frame_recv_parse_error_callback(nghttp2_session *session,
|
|||
<< ", error_code=" << lib_error_code << ":"
|
||||
<< nghttp2_strerror(lib_error_code);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
|
|
|
@ -1005,12 +1005,12 @@ int on_frame_not_send_callback(nghttp2_session *session,
|
|||
} // namespace
|
||||
|
||||
namespace {
|
||||
void on_frame_recv_parse_error_callback(nghttp2_session *session,
|
||||
nghttp2_frame_type type,
|
||||
const uint8_t *head, size_t headlen,
|
||||
const uint8_t *payload,
|
||||
size_t payloadlen, int lib_error_code,
|
||||
void *user_data)
|
||||
int on_frame_recv_parse_error_callback(nghttp2_session *session,
|
||||
nghttp2_frame_type type,
|
||||
const uint8_t *head, size_t headlen,
|
||||
const uint8_t *payload,
|
||||
size_t payloadlen, int lib_error_code,
|
||||
void *user_data)
|
||||
{
|
||||
auto spdy = reinterpret_cast<SpdySession*>(user_data);
|
||||
if(LOG_ENABLED(INFO)) {
|
||||
|
@ -1019,6 +1019,7 @@ void on_frame_recv_parse_error_callback(nghttp2_session *session,
|
|||
<< ", lib_error_code=" << lib_error_code << ":"
|
||||
<< nghttp2_strerror(lib_error_code);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
|
|
Loading…
Reference in New Issue