From 1158de22a394d90ed6355cc7022dd3990999dfb6 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Wed, 9 May 2012 23:10:52 +0900 Subject: [PATCH] Added status_code argument to spdylay_on_invalid_ctrl_recv_callback --- lib/includes/spdylay/spdylay.h | 8 +++++--- lib/spdylay_session.c | 3 ++- tests/spdylay_session_test.c | 1 + 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/includes/spdylay/spdylay.h b/lib/includes/spdylay/spdylay.h index 750edbe3..843eceb0 100644 --- a/lib/includes/spdylay/spdylay.h +++ b/lib/includes/spdylay/spdylay.h @@ -856,12 +856,14 @@ typedef void (*spdylay_on_ctrl_recv_callback) * @functypedef * * Callback function invoked by `spdylay_session_recv()` when an - * invalid control frame is received. When this callback function is - * invoked, either RST_STREAM or GOAWAY will be sent. + * invalid control frame is received. The |status_code| is one of the + * :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) (spdylay_session *session, spdylay_frame_type type, spdylay_frame *frame, - void *user_data); + uint32_t status_code, void *user_data); /** * @functypedef diff --git a/lib/spdylay_session.c b/lib/spdylay_session.c index 7811c78b..7b08e7b5 100644 --- a/lib/spdylay_session.c +++ b/lib/spdylay_session.c @@ -1630,7 +1630,7 @@ static int spdylay_session_handle_invalid_stream } if(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; } @@ -1659,6 +1659,7 @@ int spdylay_session_on_syn_stream_received(spdylay_session *session, session->callbacks.on_invalid_ctrl_recv_callback(session, SPDYLAY_SYN_STREAM, frame, + SPDYLAY_PROTOCOL_ERROR, session->user_data); } return spdylay_session_fail_session(session, SPDYLAY_GOAWAY_PROTOCOL_ERROR); diff --git a/tests/spdylay_session_test.c b/tests/spdylay_session_test.c index a8c62d2f..24d2fc84 100644 --- a/tests/spdylay_session_test.c +++ b/tests/spdylay_session_test.c @@ -128,6 +128,7 @@ static void on_ctrl_recv_callback(spdylay_session *session, static void on_invalid_ctrl_recv_callback(spdylay_session *session, spdylay_frame_type type, spdylay_frame *frame, + uint32_t status_code, void *user_data) { my_user_data *ud = (my_user_data*)user_data;