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,7 +1681,7 @@ 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
|
||||
if(session->callbacks.on_frame_recv_parse_error_callback
|
||||
(session,
|
||||
type,
|
||||
session->iframe.headbuf,
|
||||
|
@ -1689,7 +1689,9 @@ static int nghttp2_session_handle_parse_error(nghttp2_session *session,
|
|||
session->iframe.buf,
|
||||
session->iframe.buflen,
|
||||
lib_error_code,
|
||||
session->user_data);
|
||||
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,7 +354,7 @@ int on_frame_not_send_callback(nghttp2_session *session,
|
|||
} // namespace
|
||||
|
||||
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,
|
||||
const uint8_t *payload,
|
||||
|
@ -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,7 +1005,7 @@ int on_frame_not_send_callback(nghttp2_session *session,
|
|||
} // namespace
|
||||
|
||||
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,
|
||||
const uint8_t *payload,
|
||||
|
@ -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