From ca57c2f6b633ed5ad1568a86e173fc45d51d8c73 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sat, 29 Nov 2014 16:28:08 +0900 Subject: [PATCH] Rename NGHTTP2_GOAWAY_FAIL_ON_SEND with NGHTTP2_GOAWAY_TERM_ON_FAIL --- lib/nghttp2_session.c | 8 ++++---- lib/nghttp2_session.h | 2 +- tests/nghttp2_session_test.c | 20 ++++++++++---------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/lib/nghttp2_session.c b/lib/nghttp2_session.c index 1f9ad5b9..0a139511 100644 --- a/lib/nghttp2_session.c +++ b/lib/nghttp2_session.c @@ -128,7 +128,7 @@ static int session_terminate_session(nghttp2_session *session, const uint8_t *debug_data; size_t debug_datalen; - if (session->goaway_flags & NGHTTP2_GOAWAY_FAIL_ON_SEND) { + if (session->goaway_flags & NGHTTP2_GOAWAY_TERM_ON_SEND) { return 0; } @@ -147,7 +147,7 @@ static int session_terminate_session(nghttp2_session *session, return rv; } - session->goaway_flags |= NGHTTP2_GOAWAY_FAIL_ON_SEND; + session->goaway_flags |= NGHTTP2_GOAWAY_TERM_ON_SEND; return 0; } @@ -5587,7 +5587,7 @@ int nghttp2_session_want_read(nghttp2_session *session) { /* If these flags are set, we don't want to read. The application should drop the connection. */ - if ((session->goaway_flags & NGHTTP2_GOAWAY_FAIL_ON_SEND) && + if ((session->goaway_flags & NGHTTP2_GOAWAY_TERM_ON_SEND) && (session->goaway_flags & NGHTTP2_GOAWAY_TERM_SENT)) { return 0; } @@ -5610,7 +5610,7 @@ int nghttp2_session_want_write(nghttp2_session *session) { /* If these flags are set, we don't want to write any data. The application should drop the connection. */ - if ((session->goaway_flags & NGHTTP2_GOAWAY_FAIL_ON_SEND) && + if ((session->goaway_flags & NGHTTP2_GOAWAY_TERM_ON_SEND) && (session->goaway_flags & NGHTTP2_GOAWAY_TERM_SENT)) { return 0; } diff --git a/lib/nghttp2_session.h b/lib/nghttp2_session.h index b51e117d..61e6fba7 100644 --- a/lib/nghttp2_session.h +++ b/lib/nghttp2_session.h @@ -127,7 +127,7 @@ typedef struct { typedef enum { NGHTTP2_GOAWAY_NONE = 0, /* Flag means that connection should be terminated after sending GOAWAY. */ - NGHTTP2_GOAWAY_FAIL_ON_SEND = 0x1, + NGHTTP2_GOAWAY_TERM_ON_SEND = 0x1, /* Flag means GOAWAY to terminate session has been sent */ NGHTTP2_GOAWAY_TERM_SENT = 0x2, } nghttp2_goaway_flag; diff --git a/tests/nghttp2_session_test.c b/tests/nghttp2_session_test.c index 3c902c95..c2f8f01c 100644 --- a/tests/nghttp2_session_test.c +++ b/tests/nghttp2_session_test.c @@ -1716,7 +1716,7 @@ void test_nghttp2_session_on_request_headers_received(void) { CU_ASSERT(NGHTTP2_ERR_IGN_HEADER_BLOCK == nghttp2_session_on_request_headers_received(session, &frame)); CU_ASSERT(1 == user_data.invalid_frame_recv_cb_called); - CU_ASSERT(0 == (session->goaway_flags & NGHTTP2_GOAWAY_FAIL_ON_SEND)); + CU_ASSERT(0 == (session->goaway_flags & NGHTTP2_GOAWAY_TERM_ON_SEND)); nghttp2_frame_headers_free(&frame.headers); session->local_settings.max_concurrent_streams = @@ -1731,7 +1731,7 @@ void test_nghttp2_session_on_request_headers_received(void) { CU_ASSERT(NGHTTP2_ERR_IGN_HEADER_BLOCK == nghttp2_session_on_request_headers_received(session, &frame)); CU_ASSERT(0 == user_data.invalid_frame_recv_cb_called); - CU_ASSERT(0 == (session->goaway_flags & NGHTTP2_GOAWAY_FAIL_ON_SEND)); + CU_ASSERT(0 == (session->goaway_flags & NGHTTP2_GOAWAY_TERM_ON_SEND)); nghttp2_frame_headers_free(&frame.headers); @@ -1744,7 +1744,7 @@ void test_nghttp2_session_on_request_headers_received(void) { CU_ASSERT(NGHTTP2_ERR_IGN_HEADER_BLOCK == nghttp2_session_on_request_headers_received(session, &frame)); CU_ASSERT(1 == user_data.invalid_frame_recv_cb_called); - CU_ASSERT(session->goaway_flags & NGHTTP2_GOAWAY_FAIL_ON_SEND); + CU_ASSERT(session->goaway_flags & NGHTTP2_GOAWAY_TERM_ON_SEND); nghttp2_frame_headers_free(&frame.headers); @@ -1779,7 +1779,7 @@ void test_nghttp2_session_on_request_headers_received(void) { CU_ASSERT(NGHTTP2_ERR_IGN_HEADER_BLOCK == nghttp2_session_on_request_headers_received(session, &frame)); CU_ASSERT(1 == user_data.invalid_frame_recv_cb_called); - CU_ASSERT(session->goaway_flags & NGHTTP2_GOAWAY_FAIL_ON_SEND); + CU_ASSERT(session->goaway_flags & NGHTTP2_GOAWAY_TERM_ON_SEND); nghttp2_frame_headers_free(&frame.headers); @@ -1795,7 +1795,7 @@ void test_nghttp2_session_on_request_headers_received(void) { CU_ASSERT(NGHTTP2_ERR_IGN_HEADER_BLOCK == nghttp2_session_on_request_headers_received(session, &frame)); CU_ASSERT(1 == user_data.invalid_frame_recv_cb_called); - CU_ASSERT(session->goaway_flags & NGHTTP2_GOAWAY_FAIL_ON_SEND); + CU_ASSERT(session->goaway_flags & NGHTTP2_GOAWAY_TERM_ON_SEND); nghttp2_frame_headers_free(&frame.headers); @@ -1814,7 +1814,7 @@ void test_nghttp2_session_on_request_headers_received(void) { CU_ASSERT(NGHTTP2_ERR_IGN_HEADER_BLOCK == nghttp2_session_on_request_headers_received(session, &frame)); CU_ASSERT(0 == user_data.invalid_frame_recv_cb_called); - CU_ASSERT(0 == (session->goaway_flags & NGHTTP2_GOAWAY_FAIL_ON_SEND)); + CU_ASSERT(0 == (session->goaway_flags & NGHTTP2_GOAWAY_TERM_ON_SEND)); nghttp2_frame_headers_free(&frame.headers); @@ -1841,7 +1841,7 @@ void test_nghttp2_session_on_request_headers_received(void) { CU_ASSERT(NGHTTP2_ERR_IGN_HEADER_BLOCK == nghttp2_session_on_request_headers_received(session, &frame)); CU_ASSERT(0 == user_data.invalid_frame_recv_cb_called); - CU_ASSERT(0 == (session->goaway_flags & NGHTTP2_GOAWAY_FAIL_ON_SEND)); + CU_ASSERT(0 == (session->goaway_flags & NGHTTP2_GOAWAY_TERM_ON_SEND)); nghttp2_frame_headers_free(&frame.headers); @@ -2589,9 +2589,9 @@ void test_nghttp2_session_on_window_update_received(void) { nghttp2_frame_window_update_init(&frame.window_update, NGHTTP2_FLAG_NONE, 2, 4096); - CU_ASSERT(!(session->goaway_flags & NGHTTP2_GOAWAY_FAIL_ON_SEND)); + CU_ASSERT(!(session->goaway_flags & NGHTTP2_GOAWAY_TERM_ON_SEND)); CU_ASSERT(0 == nghttp2_session_on_window_update_received(session, &frame)); - CU_ASSERT(session->goaway_flags & NGHTTP2_GOAWAY_FAIL_ON_SEND); + CU_ASSERT(session->goaway_flags & NGHTTP2_GOAWAY_TERM_ON_SEND); nghttp2_frame_window_update_free(&frame.window_update); @@ -2608,7 +2608,7 @@ void test_nghttp2_session_on_window_update_received(void) { 4096); CU_ASSERT(0 == nghttp2_session_on_window_update_received(session, &frame)); - CU_ASSERT(!(session->goaway_flags & NGHTTP2_GOAWAY_FAIL_ON_SEND)); + CU_ASSERT(!(session->goaway_flags & NGHTTP2_GOAWAY_TERM_ON_SEND)); CU_ASSERT(NGHTTP2_INITIAL_WINDOW_SIZE + 4096 == stream->remote_window_size);