From 0a7c510147dff49d37759c604712f8331f07c333 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Thu, 8 Mar 2012 00:37:18 +0900 Subject: [PATCH] Renamed SPDYLAY_ERR_STREAM_ALREADY_CLOSED as SPDYLAY_ERR_STREAM_CLOSED Added doc for spdylay_error values --- lib/includes/spdylay/spdylay.h | 16 +++++++++++++++- lib/spdylay_session.c | 12 ++++++------ tests/spdylay_session_test.c | 2 +- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/lib/includes/spdylay/spdylay.h b/lib/includes/spdylay/spdylay.h index acc71d1b..336ebea9 100644 --- a/lib/includes/spdylay/spdylay.h +++ b/lib/includes/spdylay/spdylay.h @@ -52,14 +52,28 @@ typedef enum { SPDYLAY_ERR_INVALID_FRAME = -506, SPDYLAY_ERR_EOF = -507, SPDYLAY_ERR_DEFERRED = -508, + /* Stream ID has reached maximum value. Therefore no stream ID is + available. */ SPDYLAY_ERR_STREAM_ID_NOT_AVAILABLE = -509, - SPDYLAY_ERR_STREAM_ALREADY_CLOSED = -510, + /* The stream is already closed or it does not exist. */ + SPDYLAY_ERR_STREAM_CLOSED = -510, + /* RST_STREAM has been queued in outbound queue. The stream is in + closing state. */ SPDYLAY_ERR_STREAM_CLOSING = -511, + /* The transmission is not allowed for this stream (e.g., a frame + with FIN flag set has already sent) */ SPDYLAY_ERR_STREAM_SHUT_WR = -512, + /* The stream ID is invalid. */ SPDYLAY_ERR_INVALID_STREAM_ID = -513, + /* The state of the stream is not valid (e.g., SYN_REPLY cannot be + sent to the stream where SYN_REPLY has been already sent). */ SPDYLAY_ERR_INVALID_STREAM_STATE = -514, + /* Another DATA frame has already been deferred. */ SPDYLAY_ERR_DEFERRED_DATA_EXIST = -515, + /* SYN_STREAM is not allowed. (e.g., GOAWAY has been sent and/or + received. */ SPDYLAY_ERR_SYN_STREAM_NOT_ALLOWED = -516, + /* GOAWAY has been already sent. */ SPDYLAY_ERR_GOAWAY_ALREADY_SENT = -517, /* The errors < SPDYLAY_ERR_FATAL mean that the library is under unexpected condition that it cannot process any further data diff --git a/lib/spdylay_session.c b/lib/spdylay_session.c index abe0262d..f401b28b 100644 --- a/lib/spdylay_session.c +++ b/lib/spdylay_session.c @@ -449,7 +449,7 @@ void spdylay_session_close_pushed_streams(spdylay_session *session, static int spdylay_predicate_stream_for_send(spdylay_stream *stream) { if(stream == NULL) { - return SPDYLAY_ERR_STREAM_ALREADY_CLOSED; + return SPDYLAY_ERR_STREAM_CLOSED; } else if(stream->shut_flags & SPDYLAY_SHUT_WR) { return SPDYLAY_ERR_STREAM_SHUT_WR; } else { @@ -464,7 +464,7 @@ static int spdylay_predicate_stream_for_send(spdylay_stream *stream) * This function returns 0 if it succeeds, or one of the following * negative error codes: * - * SPDYLAY_ERR_STREAM_ALREADY_CLOSED + * SPDYLAY_ERR_STREAM_CLOSED * The stream is already closed or does not exist. * SPDYLAY_ERR_STREAM_SHUT_WR * The transmission is not allowed for this stream (e.g., a frame @@ -506,7 +506,7 @@ static int spdylay_session_predicate_syn_reply_send(spdylay_session *session, * This function returns 0 if it succeeds, or one of the following * negative error codes: * - * SPDYLAY_ERR_STREAM_ALREADY_CLOSED + * SPDYLAY_ERR_STREAM_CLOSED * The stream is already closed or does not exist. * SPDYLAY_ERR_STREAM_SHUT_WR * The transmission is not allowed for this stream (e.g., a frame @@ -551,7 +551,7 @@ static int spdylay_session_predicate_headers_send(spdylay_session *session, * This function returns 0 if it succeeds, or one of the following * negative error codes: * - * SPDYLAY_ERR_STREAM_ALREADY_CLOSED + * SPDYLAY_ERR_STREAM_CLOSED * The stream is already closed or does not exist. * SPDYLAY_ERR_STREAM_CLOSING * RST_STREAM was queued for this stream. @@ -562,7 +562,7 @@ static int spdylay_session_predicate_window_update_send { spdylay_stream *stream = spdylay_session_get_stream(session, stream_id); if(stream == NULL) { - return SPDYLAY_ERR_STREAM_ALREADY_CLOSED; + return SPDYLAY_ERR_STREAM_CLOSED; } if(stream->state != SPDYLAY_STREAM_CLOSING) { return 0; @@ -596,7 +596,7 @@ static size_t spdylay_session_next_data_read(spdylay_session *session, * This function returns 0 if it succeeds, or one of the following * negative error codes: * - * SPDYLAY_ERR_STREAM_ALREADY_CLOSED + * SPDYLAY_ERR_STREAM_CLOSED * The stream is already closed or does not exist. * SPDYLAY_ERR_STREAM_SHUT_WR * The transmission is not allowed for this stream (e.g., a frame diff --git a/tests/spdylay_session_test.c b/tests/spdylay_session_test.c index eace1b53..0aab1b85 100644 --- a/tests/spdylay_session_test.c +++ b/tests/spdylay_session_test.c @@ -1747,7 +1747,7 @@ void test_spdylay_session_on_ctrl_not_send() CU_ASSERT(0 == spdylay_session_send(session)); CU_ASSERT(1 == user_data.ctrl_not_send_cb_called); CU_ASSERT(SPDYLAY_SYN_REPLY == user_data.not_sent_frame_type); - CU_ASSERT(SPDYLAY_ERR_STREAM_ALREADY_CLOSED == user_data.not_sent_error); + CU_ASSERT(SPDYLAY_ERR_STREAM_CLOSED == user_data.not_sent_error); user_data.ctrl_not_send_cb_called = 0; /* Shutdown transmission */