From b5c9334ae660c9166970fb04ef29861ce0595d93 Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Mon, 11 Jul 2016 23:51:11 -0700 Subject: [PATCH] discount grpc framing bytes --- src/core/ext/transport/chttp2/transport/writing.c | 5 +++++ test/core/end2end/tests/load_reporting_hook.c | 7 ++----- third_party/protobuf | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/writing.c b/src/core/ext/transport/chttp2/transport/writing.c index b19f5f068df..9182177ee87 100644 --- a/src/core/ext/transport/chttp2/transport/writing.c +++ b/src/core/ext/transport/chttp2/transport/writing.c @@ -198,6 +198,7 @@ static void finalize_outbuf(grpc_exec_ctx *exec_ctx, GPR_TIMER_BEGIN("finalize_outbuf", 0); + bool is_first_data_frame = true; while ( grpc_chttp2_list_pop_writing_stream(transport_writing, &stream_writing)) { uint32_t max_outgoing = @@ -262,6 +263,10 @@ static void finalize_outbuf(grpc_exec_ctx *exec_ctx, stream_writing->id, &stream_writing->flow_controlled_buffer, send_bytes, is_last_frame, &stream_writing->stats, &transport_writing->outbuf); + if (is_first_data_frame) { + stream_writing->stats.data_bytes -= 5; /* discount grpc framing */ + is_first_data_frame = false; + } GRPC_CHTTP2_FLOW_DEBIT_STREAM("write", transport_writing, stream_writing, outgoing_window, send_bytes); diff --git a/test/core/end2end/tests/load_reporting_hook.c b/test/core/end2end/tests/load_reporting_hook.c index 5ee973a1db7..b9cd325c26e 100644 --- a/test/core/end2end/tests/load_reporting_hook.c +++ b/test/core/end2end/tests/load_reporting_hook.c @@ -356,11 +356,8 @@ static void test_load_reporting_hook(grpc_end2end_test_config config) { config.tear_down_data(&f); GPR_ASSERT(aggr_stats_server->fully_processed); - GPR_ASSERT(aggr_stats_server->incoming_bytes == - /* 5 FIXME */ /* compression bit(1) + msg length(4) */ +strlen( - request_msg)); - GPR_ASSERT(aggr_stats_server->outgoing_bytes == - 5 /* compression bit(1) + msg length(4) */ + strlen(response_msg)); + GPR_ASSERT(aggr_stats_server->incoming_bytes == strlen(request_msg)); + GPR_ASSERT(aggr_stats_server->outgoing_bytes == strlen(response_msg)); GPR_ASSERT(aggr_stats_server->call_id > 0); GPR_ASSERT(aggr_stats_server->channel_id > 0); diff --git a/third_party/protobuf b/third_party/protobuf index d4d13a4349e..bdeb215cab2 160000 --- a/third_party/protobuf +++ b/third_party/protobuf @@ -1 +1 @@ -Subproject commit d4d13a4349e4e59d67f311185ddcc1890d956d7a +Subproject commit bdeb215cab2985195325fcd5e70c3fa751f46e0f