diff options
-rw-r--r-- | src/core/lib/surface/lame_client.c | 7 | ||||
-rw-r--r-- | test/core/end2end/fixtures/proxy.c | 4 | ||||
-rw-r--r-- | test/core/end2end/invalid_call_argument_test.c | 1 | ||||
-rw-r--r-- | test/core/end2end/tests/max_concurrent_streams.c | 2 | ||||
-rw-r--r-- | test/core/transport/chttp2/hpack_encoder_test.c | 14 |
5 files changed, 22 insertions, 6 deletions
diff --git a/src/core/lib/surface/lame_client.c b/src/core/lib/surface/lame_client.c index a43969be57..e713893fef 100644 --- a/src/core/lib/surface/lame_client.c +++ b/src/core/lib/surface/lame_client.c @@ -49,6 +49,7 @@ typedef struct { grpc_linked_mdelem status; grpc_linked_mdelem details; + gpr_atm filled_metadata; } call_data; typedef struct { @@ -59,6 +60,9 @@ typedef struct { static void fill_metadata(grpc_exec_ctx *exec_ctx, grpc_call_element *elem, grpc_metadata_batch *mdb) { call_data *calld = elem->call_data; + if (!gpr_atm_no_barrier_cas(&calld->filled_metadata, 0, 1)) { + return; + } channel_data *chand = elem->channel_data; char tmp[GPR_LTOA_MIN_BUFSIZE]; gpr_ltoa(chand->error_code, tmp); @@ -72,6 +76,7 @@ static void fill_metadata(grpc_exec_ctx *exec_ctx, grpc_call_element *elem, calld->details.prev = &calld->status; mdb->list.head = &calld->status; mdb->list.tail = &calld->details; + mdb->list.count = 2; mdb->deadline = gpr_inf_future(GPR_CLOCK_REALTIME); } @@ -118,6 +123,8 @@ static void lame_start_transport_op(grpc_exec_ctx *exec_ctx, static grpc_error *init_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem, grpc_call_element_args *args) { + call_data *calld = elem->call_data; + gpr_atm_no_barrier_store(&calld->filled_metadata, 0); return GRPC_ERROR_NONE; } diff --git a/test/core/end2end/fixtures/proxy.c b/test/core/end2end/fixtures/proxy.c index c592f5a471..30bb9ff1b3 100644 --- a/test/core/end2end/fixtures/proxy.c +++ b/test/core/end2end/fixtures/proxy.c @@ -111,6 +111,7 @@ grpc_end2end_proxy *grpc_end2end_proxy_create(const grpc_end2end_proxy_def *def, grpc_server_register_completion_queue(proxy->server, proxy->cq, NULL); grpc_server_start(proxy->server); + grpc_call_details_init(&proxy->new_call_details); gpr_thd_options_set_joinable(&opt); GPR_ASSERT(gpr_thd_new(&proxy->thd, thread_main, proxy, &opt)); @@ -398,6 +399,9 @@ static void on_new_call(void *arg, int success) { request_call(proxy); + grpc_call_details_destroy(&proxy->new_call_details); + grpc_call_details_init(&proxy->new_call_details); + unrefpc(pc, "init"); } else { GPR_ASSERT(proxy->new_call == NULL); diff --git a/test/core/end2end/invalid_call_argument_test.c b/test/core/end2end/invalid_call_argument_test.c index 3b26ddb6d0..3a68e55ba3 100644 --- a/test/core/end2end/invalid_call_argument_test.c +++ b/test/core/end2end/invalid_call_argument_test.c @@ -75,6 +75,7 @@ static void prepare_test(int is_client) { g_state.deadline = GRPC_TIMEOUT_SECONDS_TO_DEADLINE(2); g_state.cq = grpc_completion_queue_create(NULL); g_state.cqv = cq_verifier_create(g_state.cq); + g_state.details = grpc_empty_slice(); memset(g_state.ops, 0, sizeof(g_state.ops)); if (is_client) { diff --git a/test/core/end2end/tests/max_concurrent_streams.c b/test/core/end2end/tests/max_concurrent_streams.c index 56243179b0..b34ea40f1b 100644 --- a/test/core/end2end/tests/max_concurrent_streams.c +++ b/test/core/end2end/tests/max_concurrent_streams.c @@ -391,6 +391,8 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) { CQ_EXPECT_COMPLETION(cqv, tag(live_call + 1), 1); cq_verify(cqv); + grpc_call_details_destroy(&call_details); + GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call( f.server, &s2, &call_details, &request_metadata_recv, f.cq, f.cq, tag(201))); diff --git a/test/core/transport/chttp2/hpack_encoder_test.c b/test/core/transport/chttp2/hpack_encoder_test.c index 9e418bad5d..d572d79a7f 100644 --- a/test/core/transport/chttp2/hpack_encoder_test.c +++ b/test/core/transport/chttp2/hpack_encoder_test.c @@ -81,9 +81,9 @@ static void verify(grpc_exec_ctx *exec_ctx, size_t window_available, int eof, e[i - 1].next = &e[i]; e[i].prev = &e[i - 1]; } - e[i].md = - grpc_mdelem_from_slices(exec_ctx, grpc_slice_from_copied_string(key), - grpc_slice_from_copied_string(value)); + e[i].md = grpc_mdelem_from_slices( + exec_ctx, grpc_slice_intern(grpc_slice_from_static_string(key)), + grpc_slice_intern(grpc_slice_from_static_string(value))); } e[0].prev = NULL; e[nheaders - 1].next = NULL; @@ -91,6 +91,7 @@ static void verify(grpc_exec_ctx *exec_ctx, size_t window_available, int eof, b.list.head = &e[0]; b.list.tail = &e[nheaders - 1]; + b.list.count = nheaders; if (cap_to_delete == num_to_delete) { cap_to_delete = GPR_MAX(2 * cap_to_delete, 1000); @@ -195,9 +196,9 @@ static void verify_table_size_change_match_elem_size(grpc_exec_ctx *exec_ctx, const char *key, const char *value) { grpc_slice_buffer output; - grpc_mdelem elem = - grpc_mdelem_from_slices(exec_ctx, grpc_slice_from_copied_string(key), - grpc_slice_from_copied_string(value)); + grpc_mdelem elem = grpc_mdelem_from_slices( + exec_ctx, grpc_slice_intern(grpc_slice_from_static_string(key)), + grpc_slice_intern(grpc_slice_from_static_string(value))); size_t elem_size = grpc_mdelem_get_size_in_hpack_table(elem); size_t initial_table_size = g_compressor.table_size; grpc_linked_mdelem *e = gpr_malloc(sizeof(*e)); @@ -208,6 +209,7 @@ static void verify_table_size_change_match_elem_size(grpc_exec_ctx *exec_ctx, e[0].next = NULL; b.list.head = &e[0]; b.list.tail = &e[0]; + b.list.count = 1; grpc_slice_buffer_init(&output); grpc_transport_one_way_stats stats; |