diff --git a/lib/includes/spdylay/spdylay.h b/lib/includes/spdylay/spdylay.h index 623021f2..01d75d8c 100644 --- a/lib/includes/spdylay/spdylay.h +++ b/lib/includes/spdylay/spdylay.h @@ -1430,6 +1430,25 @@ size_t spdylay_session_get_outbound_queue_size(spdylay_session *session); */ uint8_t spdylay_session_get_pri_lowest(spdylay_session *session); +/* + * @function + * + * Submits GOAWAY frame. The status code |status_code| is ignored if + * the protocol version is :macro:`SPDYLAY_PROTO_SPDY2`. + * + * This function should be called when the connection should be + * terminated after sending GOAWAY. If the remaining streams should be + * processed after GOAWAY, use `spdylay_submit_goaway()` instead. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * :enum:`SPDYLAY_ERR_NOMEM` + * Out of memory. + */ +int spdylay_session_fail_session(spdylay_session *session, + uint32_t status_code); + /** * @function * diff --git a/lib/spdylay_session.c b/lib/spdylay_session.c index aaaf2551..52199beb 100644 --- a/lib/spdylay_session.c +++ b/lib/spdylay_session.c @@ -63,13 +63,8 @@ static int spdylay_is_fatal(int error) return error < SPDYLAY_ERR_FATAL; } -/* - * This function should be called when the session wants to drop - * connection after sending GOAWAY. These cases are called as the - * session error. For example, when it receives bad zlib data. - */ -static int spdylay_session_fail_session(spdylay_session *session, - uint32_t status_code) +int spdylay_session_fail_session(spdylay_session *session, + uint32_t status_code) { session->goaway_flags |= SPDYLAY_GOAWAY_FAIL_ON_SEND; return spdylay_submit_goaway(session, status_code);