diff options
author | Abhishek Kumar <abhikumar@google.com> | 2015-02-10 16:39:40 -0800 |
---|---|---|
committer | Abhishek Kumar <abhikumar@google.com> | 2015-02-10 16:39:40 -0800 |
commit | 787a92491ff38654ec9ad3e8439096a607cedd3e (patch) | |
tree | 9ff417155961b7d7972cd46382fcfbb64d1420f2 /test/core/fling | |
parent | 38f9651468b6b72a30c66a5c1309bd225d3ff71a (diff) |
Updated ping_pong_request to new API
Diffstat (limited to 'test/core/fling')
-rw-r--r-- | test/core/fling/client.c | 41 |
1 files changed, 30 insertions, 11 deletions
diff --git a/test/core/fling/client.c b/test/core/fling/client.c index a91dfba9b0..096dc09772 100644 --- a/test/core/fling/client.c +++ b/test/core/fling/client.c @@ -49,22 +49,21 @@ static grpc_byte_buffer *the_buffer; static grpc_channel *channel; static grpc_completion_queue *cq; static grpc_call *call; +static grpc_op ops[6]; +static grpc_metadata_array initial_metadata_recv; +static grpc_metadata_array trailing_metadata_recv; +static grpc_byte_buffer *response_payload_recv = NULL; +static grpc_call_details call_details; +static grpc_status_code status; +static char *details = NULL; +static size_t details_capacity = 0; static void init_ping_pong_request(void) {} static void step_ping_pong_request(void) { - call = grpc_channel_create_call_old(channel, "/Reflector/reflectUnary", + call = grpc_channel_create_call(channel, cq, "/Reflector/reflectUnary", "localhost", gpr_inf_future); - GPR_ASSERT(grpc_call_invoke_old(call, cq, (void *)1, (void *)1, - GRPC_WRITE_BUFFER_HINT) == GRPC_CALL_OK); - GPR_ASSERT(grpc_call_start_write_old(call, the_buffer, (void *)1, - GRPC_WRITE_BUFFER_HINT) == GRPC_CALL_OK); - grpc_event_finish(grpc_completion_queue_next(cq, gpr_inf_future)); - GPR_ASSERT(grpc_call_start_read_old(call, (void *)1) == GRPC_CALL_OK); - GPR_ASSERT(grpc_call_writes_done_old(call, (void *)1) == GRPC_CALL_OK); - grpc_event_finish(grpc_completion_queue_next(cq, gpr_inf_future)); - grpc_event_finish(grpc_completion_queue_next(cq, gpr_inf_future)); - grpc_event_finish(grpc_completion_queue_next(cq, gpr_inf_future)); + GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(call, ops, 6, (void *)1)); grpc_event_finish(grpc_completion_queue_next(cq, gpr_inf_future)); grpc_call_destroy(call); call = NULL; @@ -148,6 +147,26 @@ int main(int argc, char **argv) { cq = grpc_completion_queue_create(); the_buffer = grpc_byte_buffer_create(&slice, payload_size); histogram = gpr_histogram_create(0.01, 60e9); + + grpc_metadata_array_init(&initial_metadata_recv); + grpc_metadata_array_init(&trailing_metadata_recv); + grpc_call_details_init(&call_details); + + ops[0].op = GRPC_OP_SEND_INITIAL_METADATA; + ops[0].data.send_initial_metadata.count = 0; + ops[1].op = GRPC_OP_SEND_MESSAGE; + ops[1].data.send_message = the_buffer; + ops[2].op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; + ops[3].op = GRPC_OP_RECV_INITIAL_METADATA; + ops[3].data.recv_initial_metadata = &initial_metadata_recv; + ops[4].op = GRPC_OP_RECV_MESSAGE; + ops[4].data.recv_message = &response_payload_recv; + ops[5].op = GRPC_OP_RECV_STATUS_ON_CLIENT; + ops[5].data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; + ops[5].data.recv_status_on_client.status = &status; + ops[5].data.recv_status_on_client.status_details = &details; + ops[5].data.recv_status_on_client.status_details_capacity = &details_capacity; + sc.init(); for (i = 0; i < 1000; i++) { |