Add int return value to nghttp2_on_unknown_frame_recv_callback

This commit is contained in:
Tatsuhiro Tsujikawa 2013-08-29 23:10:18 +09:00
parent db4f519500
commit 59286adc5e
6 changed files with 28 additions and 18 deletions

View File

@ -972,8 +972,13 @@ typedef int (*nghttp2_on_frame_recv_parse_error_callback)
* first 8 bytes of the received frame. The |payload| is the pointer
* to the data portion of the received frame. The |payloadlen| is the
* length of the |payload|. This is the data after the length field.
*
* 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_unknown_frame_recv_callback)
typedef int (*nghttp2_on_unknown_frame_recv_callback)
(nghttp2_session *session,
const uint8_t *head, size_t headlen,
const uint8_t *payload, size_t payloadlen,

View File

@ -2669,13 +2669,15 @@ static int nghttp2_session_process_ctrl_frame(nghttp2_session *session)
default:
/* Unknown frame */
if(session->callbacks.on_unknown_frame_recv_callback) {
session->callbacks.on_unknown_frame_recv_callback
if(session->callbacks.on_unknown_frame_recv_callback
(session,
session->iframe.headbuf,
sizeof(session->iframe.headbuf),
session->iframe.buf,
session->iframe.buflen,
session->user_data);
session->user_data) != 0) {
r = NGHTTP2_ERR_CALLBACK_FAILURE;
}
}
}
if(nghttp2_is_fatal(r)) {

View File

@ -377,7 +377,7 @@ int on_frame_recv_parse_error_callback(nghttp2_session *session,
return 0;
}
void on_unknown_frame_recv_callback(nghttp2_session *session,
int on_unknown_frame_recv_callback(nghttp2_session *session,
const uint8_t *head,
size_t headlen,
const uint8_t *payload,
@ -388,6 +388,7 @@ void on_unknown_frame_recv_callback(nghttp2_session *session,
printf(" recv unknown frame\n");
dump_header(head, headlen);
fflush(stdout);
return 0;
}
int on_frame_send_callback

View File

@ -54,7 +54,7 @@ int on_frame_recv_parse_error_callback(nghttp2_session *session,
size_t payloadlen,
int error_code, void *user_data);
void on_unknown_frame_recv_callback(nghttp2_session *session,
int on_unknown_frame_recv_callback(nghttp2_session *session,
const uint8_t *head,
size_t headlen,
const uint8_t *payload,

View File

@ -373,7 +373,7 @@ int on_frame_recv_parse_error_callback(nghttp2_session *session,
} // namespace
namespace {
void on_unknown_frame_recv_callback(nghttp2_session *session,
int on_unknown_frame_recv_callback(nghttp2_session *session,
const uint8_t *head, size_t headlen,
const uint8_t *payload, size_t payloadlen,
void *user_data)
@ -382,6 +382,7 @@ void on_unknown_frame_recv_callback(nghttp2_session *session,
if(LOG_ENABLED(INFO)) {
ULOG(INFO, upstream) << "Received unknown control frame.";
}
return 0;
}
} // namespace

View File

@ -1024,7 +1024,7 @@ int on_frame_recv_parse_error_callback(nghttp2_session *session,
} // namespace
namespace {
void on_unknown_frame_recv_callback(nghttp2_session *session,
int on_unknown_frame_recv_callback(nghttp2_session *session,
const uint8_t *head, size_t headlen,
const uint8_t *payload, size_t payloadlen,
void *user_data)
@ -1033,6 +1033,7 @@ void on_unknown_frame_recv_callback(nghttp2_session *session,
if(LOG_ENABLED(INFO)) {
SSLOG(INFO, spdy) << "Received unknown control frame";
}
return 0;
}
} // namespace