From 15c32cd4813e20cac65e9c2a8f9cea4e1d483a05 Mon Sep 17 00:00:00 2001 From: ncteisen Date: Tue, 5 Dec 2017 12:57:49 -0800 Subject: [PATCH] Fix parsing check --- .../chttp2/transport/chttp2_transport.cc | 18 +++++++++++++----- .../ext/transport/chttp2/transport/parsing.cc | 7 ++++--- .../transport/chttp2/transport/stream_lists.cc | 2 ++ test/core/end2end/tests/payload.cc | 3 +++ 4 files changed, 22 insertions(+), 8 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc index 70b30b7db20..233ea7f6a6f 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc @@ -338,11 +338,13 @@ static void init_transport(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t, } } t->dirtied_local_settings = 1; - /* Hack: it's common for implementations to assume 65536 bytes initial send - window -- this should by rights be 0 */ - t->force_send_settings = 1 << GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE; - t->sent_local_settings = 0; - t->write_buffer_size = grpc_core::chttp2::kDefaultWindow; + if (!true /*diable flow control */) { + /* Hack: it's common for implementations to assume 65536 bytes initial send + window -- this should by rights be 0 */ + t->force_send_settings = 1 << GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE; + t->sent_local_settings = 0; + t->write_buffer_size = grpc_core::chttp2::kDefaultWindow; + } if (is_client) { grpc_slice_buffer_add(&t->outbuf, grpc_slice_from_copied_string( @@ -555,6 +557,12 @@ static void init_transport(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t, kFrameSize; t->settings[GRPC_ACKED_SETTINGS][GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE] = kFrameSize; + t->settings[GRPC_PEER_SETTINGS][GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE] = + grpc_core::chttp2::kMaxWindow; + t->settings[GRPC_SENT_SETTINGS][GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE] = + grpc_core::chttp2::kMaxWindow; + t->settings[GRPC_ACKED_SETTINGS][GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE] = + grpc_core::chttp2::kMaxWindow; enable_bdp = false; } else { t->flow_control.Init(exec_ctx, t, diff --git a/src/core/ext/transport/chttp2/transport/parsing.cc b/src/core/ext/transport/chttp2/transport/parsing.cc index 46ec3fbaa61..dce6aa42276 100644 --- a/src/core/ext/transport/chttp2/transport/parsing.cc +++ b/src/core/ext/transport/chttp2/transport/parsing.cc @@ -197,9 +197,10 @@ grpc_error* grpc_chttp2_perform_read(grpc_exec_ctx* exec_ctx, return GRPC_ERROR_NONE; } goto dts_fh_0; /* loop */ - } else if (t->incoming_frame_size > - t->settings[GRPC_ACKED_SETTINGS] - [GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE]) { + } else if (!true /*disable flow control*/ && + t->incoming_frame_size > + t->settings[GRPC_ACKED_SETTINGS] + [GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE]) { char* msg; gpr_asprintf(&msg, "Frame size %d is larger than max frame size %d", t->incoming_frame_size, diff --git a/src/core/ext/transport/chttp2/transport/stream_lists.cc b/src/core/ext/transport/chttp2/transport/stream_lists.cc index c95d02541a7..c6e2bada337 100644 --- a/src/core/ext/transport/chttp2/transport/stream_lists.cc +++ b/src/core/ext/transport/chttp2/transport/stream_lists.cc @@ -183,6 +183,7 @@ void grpc_chttp2_list_remove_waiting_for_concurrency(grpc_chttp2_transport* t, void grpc_chttp2_list_add_stalled_by_transport(grpc_chttp2_transport* t, grpc_chttp2_stream* s) { + GPR_ASSERT(!true /*flow control disabled */); stream_list_add(t, s, GRPC_CHTTP2_LIST_STALLED_BY_TRANSPORT); } @@ -198,6 +199,7 @@ void grpc_chttp2_list_remove_stalled_by_transport(grpc_chttp2_transport* t, void grpc_chttp2_list_add_stalled_by_stream(grpc_chttp2_transport* t, grpc_chttp2_stream* s) { + GPR_ASSERT(!true /*flow control disabled */); stream_list_add(t, s, GRPC_CHTTP2_LIST_STALLED_BY_STREAM); } diff --git a/test/core/end2end/tests/payload.cc b/test/core/end2end/tests/payload.cc index 2e9513b9cbe..8c3fd1b668a 100644 --- a/test/core/end2end/tests/payload.cc +++ b/test/core/end2end/tests/payload.cc @@ -125,6 +125,7 @@ static void request_response_with_payload(grpc_end2end_test_config config, grpc_byte_buffer* response_payload_recv = nullptr; grpc_call_details call_details; grpc_status_code status; + const char* error_string = nullptr; grpc_call_error error; grpc_slice details; int was_cancelled = 2; @@ -172,6 +173,7 @@ static void request_response_with_payload(grpc_end2end_test_config config, op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; op->data.recv_status_on_client.status = &status; op->data.recv_status_on_client.status_details = &details; + op->data.recv_status_on_client.error_string = &error_string; op->flags = 0; op->reserved = nullptr; op++; @@ -230,6 +232,7 @@ static void request_response_with_payload(grpc_end2end_test_config config, CQ_EXPECT_COMPLETION(cqv, tag(1), 1); cq_verify(cqv); + gpr_log(GPR_ERROR, "%s", error_string); GPR_ASSERT(status == GRPC_STATUS_OK); GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz")); GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo"));