From 5e01e2ac977655aa074faf7fde0a74298f5e4c55 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 20 Jan 2017 18:11:52 -0800 Subject: Revert "Metadata handling rewrite" --- test/core/fling/client.c | 20 +++++++++----------- test/core/fling/server.c | 8 ++++---- 2 files changed, 13 insertions(+), 15 deletions(-) (limited to 'test/core/fling') diff --git a/test/core/fling/client.c b/test/core/fling/client.c index bb44320f34..e717b7f7fe 100644 --- a/test/core/fling/client.c +++ b/test/core/fling/client.c @@ -57,7 +57,8 @@ static grpc_metadata_array initial_metadata_recv; static grpc_metadata_array trailing_metadata_recv; static grpc_byte_buffer *response_payload_recv = NULL; static grpc_status_code status; -static grpc_slice details; +static char *details = NULL; +static size_t details_capacity = 0; static grpc_op *op; static void init_ping_pong_request(void) { @@ -85,16 +86,15 @@ static void init_ping_pong_request(void) { 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.status_details_capacity = &details_capacity; op++; } static void step_ping_pong_request(void) { GPR_TIMER_BEGIN("ping_pong", 1); - grpc_slice host = grpc_slice_from_static_string("localhost"); - call = grpc_channel_create_call( - channel, NULL, GRPC_PROPAGATE_DEFAULTS, cq, - grpc_slice_from_static_string("/Reflector/reflectUnary"), &host, - gpr_inf_future(GPR_CLOCK_REALTIME), NULL); + call = grpc_channel_create_call(channel, NULL, GRPC_PROPAGATE_DEFAULTS, cq, + "/Reflector/reflectUnary", "localhost", + gpr_inf_future(GPR_CLOCK_REALTIME), NULL); GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(call, ops, (size_t)(op - ops), (void *)1, NULL)); @@ -109,11 +109,9 @@ static void init_ping_pong_stream(void) { grpc_metadata_array_init(&initial_metadata_recv); grpc_call_error error; - grpc_slice host = grpc_slice_from_static_string("localhost"); - call = grpc_channel_create_call( - channel, NULL, GRPC_PROPAGATE_DEFAULTS, cq, - grpc_slice_from_static_string("/Reflector/reflectStream"), &host, - gpr_inf_future(GPR_CLOCK_REALTIME), NULL); + call = grpc_channel_create_call(channel, NULL, GRPC_PROPAGATE_DEFAULTS, cq, + "/Reflector/reflectStream", "localhost", + gpr_inf_future(GPR_CLOCK_REALTIME), NULL); stream_init_ops[0].op = GRPC_OP_SEND_INITIAL_METADATA; stream_init_ops[0].data.send_initial_metadata.count = 0; stream_init_ops[1].op = GRPC_OP_RECV_INITIAL_METADATA; diff --git a/test/core/fling/server.c b/test/core/fling/server.c index d4849e3bbe..fd446f1128 100644 --- a/test/core/fling/server.c +++ b/test/core/fling/server.c @@ -118,7 +118,7 @@ static void handle_unary_method(void) { op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; op->data.send_status_from_server.status = GRPC_STATUS_OK; op->data.send_status_from_server.trailing_metadata_count = 0; - op->data.send_status_from_server.status_details = NULL; + op->data.send_status_from_server.status_details = ""; op++; op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; @@ -168,7 +168,7 @@ static void start_send_status(void) { status_op[0].op = GRPC_OP_SEND_STATUS_FROM_SERVER; status_op[0].data.send_status_from_server.status = GRPC_STATUS_OK; status_op[0].data.send_status_from_server.trailing_metadata_count = 0; - status_op[0].data.send_status_from_server.status_details = NULL; + status_op[0].data.send_status_from_server.status_details = ""; status_op[1].op = GRPC_OP_RECV_CLOSE_ON_SERVER; status_op[1].data.recv_close_on_server.cancelled = &was_cancelled; @@ -259,8 +259,8 @@ int main(int argc, char **argv) { switch ((intptr_t)s) { case FLING_SERVER_NEW_REQUEST: if (call != NULL) { - if (0 == grpc_slice_str_cmp(call_details.method, - "/Reflector/reflectStream")) { + if (0 == + strcmp(call_details.method, "/Reflector/reflectStream")) { /* Received streaming call. Send metadata here. */ start_read_op(FLING_SERVER_READ_FOR_STREAMING); send_initial_metadata(); -- cgit v1.2.3