Added status_code argument to spdylay_on_invalid_ctrl_recv_callback

This commit is contained in:
Tatsuhiro Tsujikawa 2012-05-09 23:10:52 +09:00
parent 649e62bd33
commit 1158de22a3
3 changed files with 8 additions and 4 deletions

View File

@ -856,12 +856,14 @@ typedef void (*spdylay_on_ctrl_recv_callback)
* @functypedef * @functypedef
* *
* Callback function invoked by `spdylay_session_recv()` when an * Callback function invoked by `spdylay_session_recv()` when an
* invalid control frame is received. When this callback function is * invalid control frame is received. The |status_code| is one of the
* invoked, either RST_STREAM or GOAWAY will be sent. * :enum:`spdylay_status_code` and indicates the error. When this
* callback function is invoked, either RST_STREAM or GOAWAY will be
* sent.
*/ */
typedef void (*spdylay_on_invalid_ctrl_recv_callback) typedef void (*spdylay_on_invalid_ctrl_recv_callback)
(spdylay_session *session, spdylay_frame_type type, spdylay_frame *frame, (spdylay_session *session, spdylay_frame_type type, spdylay_frame *frame,
void *user_data); uint32_t status_code, void *user_data);
/** /**
* @functypedef * @functypedef

View File

@ -1630,7 +1630,7 @@ static int spdylay_session_handle_invalid_stream
} }
if(session->callbacks.on_invalid_ctrl_recv_callback) { if(session->callbacks.on_invalid_ctrl_recv_callback) {
session->callbacks.on_invalid_ctrl_recv_callback session->callbacks.on_invalid_ctrl_recv_callback
(session, type, frame, session->user_data); (session, type, frame, status_code, session->user_data);
} }
return 0; return 0;
} }
@ -1659,6 +1659,7 @@ int spdylay_session_on_syn_stream_received(spdylay_session *session,
session->callbacks.on_invalid_ctrl_recv_callback(session, session->callbacks.on_invalid_ctrl_recv_callback(session,
SPDYLAY_SYN_STREAM, SPDYLAY_SYN_STREAM,
frame, frame,
SPDYLAY_PROTOCOL_ERROR,
session->user_data); session->user_data);
} }
return spdylay_session_fail_session(session, SPDYLAY_GOAWAY_PROTOCOL_ERROR); return spdylay_session_fail_session(session, SPDYLAY_GOAWAY_PROTOCOL_ERROR);

View File

@ -128,6 +128,7 @@ static void on_ctrl_recv_callback(spdylay_session *session,
static void on_invalid_ctrl_recv_callback(spdylay_session *session, static void on_invalid_ctrl_recv_callback(spdylay_session *session,
spdylay_frame_type type, spdylay_frame_type type,
spdylay_frame *frame, spdylay_frame *frame,
uint32_t status_code,
void *user_data) void *user_data)
{ {
my_user_data *ud = (my_user_data*)user_data; my_user_data *ud = (my_user_data*)user_data;