diff options
author | Craig Tiller <ctiller@google.com> | 2015-09-22 09:30:00 -0700 |
---|---|---|
committer | Craig Tiller <ctiller@google.com> | 2015-09-22 09:30:00 -0700 |
commit | d9ccbbf6b98721f3e0256436e8a31fb378324d34 (patch) | |
tree | 70044a256dc950acf8b5fe203e417b00da6a1114 /test/core | |
parent | 10ee2747a92a20c0bbe8cf3e2e759a121c6cb076 (diff) |
Rename call_list to closure_list
Diffstat (limited to 'test/core')
27 files changed, 537 insertions, 515 deletions
diff --git a/test/core/bad_client/bad_client.c b/test/core/bad_client/bad_client.c index 747ce4050b..7605904411 100644 --- a/test/core/bad_client/bad_client.c +++ b/test/core/bad_client/bad_client.c @@ -59,7 +59,8 @@ static void thd_func(void *arg) { gpr_event_set(&a->done_thd, (void *)1); } -static void done_write(void *arg, int success, grpc_call_list *call_list) { +static void done_write(void *arg, int success, + grpc_closure_list *closure_list) { thd_args *a = arg; gpr_event_set(&a->done_write, (void *)1); } @@ -69,11 +70,11 @@ static void server_setup_transport(void *ts, grpc_transport *transport, thd_args *a = ts; static grpc_channel_filter const *extra_filters[] = { &grpc_http_server_filter}; - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; grpc_server_setup_transport( a->server, transport, extra_filters, GPR_ARRAY_SIZE(extra_filters), mdctx, - grpc_server_get_channel_args(a->server), &call_list); - grpc_call_list_run(&call_list); + grpc_server_get_channel_args(a->server), &closure_list); + grpc_closure_list_run(&closure_list); } void grpc_run_bad_client_test(grpc_bad_client_server_side_validator validator, @@ -89,7 +90,7 @@ void grpc_run_bad_client_test(grpc_bad_client_server_side_validator validator, gpr_slice_from_copied_buffer(client_payload, client_payload_length); gpr_slice_buffer outgoing; grpc_closure done_write_closure; - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; hex = gpr_dump(client_payload, client_payload_length, GPR_DUMP_HEX | GPR_DUMP_ASCII); @@ -114,14 +115,16 @@ void grpc_run_bad_client_test(grpc_bad_client_server_side_validator validator, grpc_server_register_completion_queue(a.server, a.cq, NULL); grpc_server_start(a.server); transport = - grpc_create_chttp2_transport(NULL, sfd.server, mdctx, 0, &call_list); + grpc_create_chttp2_transport(NULL, sfd.server, mdctx, 0, &closure_list); server_setup_transport(&a, transport, mdctx); - grpc_chttp2_transport_start_reading(transport, NULL, 0, &call_list); - grpc_call_list_run(&call_list); + grpc_chttp2_transport_start_reading(transport, NULL, 0, &closure_list); + grpc_closure_list_run(&closure_list); /* Bind everything into the same pollset */ - grpc_endpoint_add_to_pollset(sfd.client, grpc_cq_pollset(a.cq), &call_list); - grpc_endpoint_add_to_pollset(sfd.server, grpc_cq_pollset(a.cq), &call_list); + grpc_endpoint_add_to_pollset(sfd.client, grpc_cq_pollset(a.cq), + &closure_list); + grpc_endpoint_add_to_pollset(sfd.server, grpc_cq_pollset(a.cq), + &closure_list); /* Check a ground truth */ GPR_ASSERT(grpc_server_has_open_connections(a.server)); @@ -134,17 +137,18 @@ void grpc_run_bad_client_test(grpc_bad_client_server_side_validator validator, grpc_closure_init(&done_write_closure, done_write, &a); /* Write data */ - grpc_endpoint_write(sfd.client, &outgoing, &done_write_closure, &call_list); - grpc_call_list_run(&call_list); + grpc_endpoint_write(sfd.client, &outgoing, &done_write_closure, + &closure_list); + grpc_closure_list_run(&closure_list); /* Await completion */ GPR_ASSERT( gpr_event_wait(&a.done_write, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5))); if (flags & GRPC_BAD_CLIENT_DISCONNECT) { - grpc_endpoint_shutdown(sfd.client, &call_list); - grpc_endpoint_destroy(sfd.client, &call_list); - grpc_call_list_run(&call_list); + grpc_endpoint_shutdown(sfd.client, &closure_list); + grpc_endpoint_destroy(sfd.client, &closure_list); + grpc_closure_list_run(&closure_list); sfd.client = NULL; } @@ -152,9 +156,9 @@ void grpc_run_bad_client_test(grpc_bad_client_server_side_validator validator, /* Shutdown */ if (sfd.client) { - grpc_endpoint_shutdown(sfd.client, &call_list); - grpc_endpoint_destroy(sfd.client, &call_list); - grpc_call_list_run(&call_list); + grpc_endpoint_shutdown(sfd.client, &closure_list); + grpc_endpoint_destroy(sfd.client, &closure_list); + grpc_closure_list_run(&closure_list); } grpc_server_shutdown_and_notify(a.server, a.cq, NULL); GPR_ASSERT(grpc_completion_queue_pluck( @@ -164,6 +168,6 @@ void grpc_run_bad_client_test(grpc_bad_client_server_side_validator validator, grpc_completion_queue_destroy(a.cq); gpr_slice_buffer_destroy(&outgoing); - grpc_call_list_run(&call_list); + grpc_closure_list_run(&closure_list); grpc_shutdown(); } diff --git a/test/core/channel/channel_stack_test.c b/test/core/channel/channel_stack_test.c index 07df921270..72b48e208d 100644 --- a/test/core/channel/channel_stack_test.c +++ b/test/core/channel/channel_stack_test.c @@ -44,7 +44,7 @@ static void channel_init_func(grpc_channel_element *elem, grpc_channel *master, const grpc_channel_args *args, grpc_mdctx *metadata_context, int is_first, - int is_last, grpc_call_list *call_list) { + int is_last, grpc_closure_list *closure_list) { GPR_ASSERT(args->num_args == 1); GPR_ASSERT(args->args[0].type == GRPC_ARG_INTEGER); GPR_ASSERT(0 == strcmp(args->args[0].key, "test_key")); @@ -57,30 +57,31 @@ static void channel_init_func(grpc_channel_element *elem, grpc_channel *master, static void call_init_func(grpc_call_element *elem, const void *server_transport_data, grpc_transport_stream_op *initial_op, - grpc_call_list *call_list) { + grpc_closure_list *closure_list) { ++*(int *)(elem->channel_data); *(int *)(elem->call_data) = 0; } static void channel_destroy_func(grpc_channel_element *elem, - grpc_call_list *call_list) {} + grpc_closure_list *closure_list) {} static void call_destroy_func(grpc_call_element *elem, - grpc_call_list *call_list) { + grpc_closure_list *closure_list) { ++*(int *)(elem->channel_data); } static void call_func(grpc_call_element *elem, grpc_transport_stream_op *op, - grpc_call_list *call_list) { + grpc_closure_list *closure_list) { ++*(int *)(elem->call_data); } static void channel_func(grpc_channel_element *elem, grpc_transport_op *op, - grpc_call_list *call_list) { + grpc_closure_list *closure_list) { ++*(int *)(elem->channel_data); } -static char *get_peer(grpc_call_element *elem, grpc_call_list *call_list) { +static char *get_peer(grpc_call_element *elem, + grpc_closure_list *closure_list) { return gpr_strdup("peer"); } @@ -100,7 +101,7 @@ static void test_create_channel_stack(void) { grpc_mdctx *metadata_context; int *channel_data; int *call_data; - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; metadata_context = grpc_mdctx_create(); @@ -113,14 +114,14 @@ static void test_create_channel_stack(void) { channel_stack = gpr_malloc(grpc_channel_stack_size(&filters, 1)); grpc_channel_stack_init(&filters, 1, NULL, &chan_args, metadata_context, - channel_stack, &call_list); + channel_stack, &closure_list); GPR_ASSERT(channel_stack->count == 1); channel_elem = grpc_channel_stack_element(channel_stack, 0); channel_data = (int *)channel_elem->channel_data; GPR_ASSERT(*channel_data == 0); call_stack = gpr_malloc(channel_stack->call_stack_size); - grpc_call_stack_init(channel_stack, NULL, NULL, call_stack, &call_list); + grpc_call_stack_init(channel_stack, NULL, NULL, call_stack, &closure_list); GPR_ASSERT(call_stack->count == 1); call_elem = grpc_call_stack_element(call_stack, 0); GPR_ASSERT(call_elem->filter == channel_elem->filter); @@ -129,16 +130,16 @@ static void test_create_channel_stack(void) { GPR_ASSERT(*call_data == 0); GPR_ASSERT(*channel_data == 1); - grpc_call_stack_destroy(call_stack, &call_list); + grpc_call_stack_destroy(call_stack, &closure_list); gpr_free(call_stack); GPR_ASSERT(*channel_data == 2); - grpc_channel_stack_destroy(channel_stack, &call_list); + grpc_channel_stack_destroy(channel_stack, &closure_list); gpr_free(channel_stack); grpc_mdctx_unref(metadata_context); - GPR_ASSERT(grpc_call_list_empty(call_list)); + GPR_ASSERT(grpc_closure_list_empty(closure_list)); } int main(int argc, char **argv) { diff --git a/test/core/client_config/lb_policies_test.c b/test/core/client_config/lb_policies_test.c index ee3164f4fd..411e96598a 100644 --- a/test/core/client_config/lb_policies_test.c +++ b/test/core/client_config/lb_policies_test.c @@ -387,15 +387,15 @@ static void assert_channel_connectivity( grpc_channel_stack *client_stack; grpc_channel_element *client_channel_filter; grpc_connectivity_state actual_conn_state; - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; va_list ap; client_stack = grpc_channel_get_channel_stack(ch); client_channel_filter = grpc_channel_stack_last_element(client_stack); actual_conn_state = grpc_client_channel_check_connectivity_state( - client_channel_filter, 0 /* don't try to connect */, &call_list); - grpc_call_list_run(&call_list); + client_channel_filter, 0 /* don't try to connect */, &closure_list); + grpc_closure_list_run(&closure_list); va_start(ap, accepted_conn_state); for (i = 0; i < num_accepted_conn_states; i++) { if (actual_conn_state == accepted_conn_state) { diff --git a/test/core/end2end/fixtures/h2_sockpair+trace.c b/test/core/end2end/fixtures/h2_sockpair+trace.c index d0279e79ba..b79c483703 100644 --- a/test/core/end2end/fixtures/h2_sockpair+trace.c +++ b/test/core/end2end/fixtures/h2_sockpair+trace.c @@ -62,11 +62,11 @@ static void server_setup_transport(void *ts, grpc_transport *transport, grpc_end2end_test_fixture *f = ts; static grpc_channel_filter const *extra_filters[] = { &grpc_http_server_filter}; - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; grpc_server_setup_transport( f->server, transport, extra_filters, GPR_ARRAY_SIZE(extra_filters), mdctx, - grpc_server_get_channel_args(f->server), &call_list); - grpc_call_list_run(&call_list); + grpc_server_get_channel_args(f->server), &closure_list); + grpc_closure_list_run(&closure_list); } typedef struct { @@ -76,7 +76,7 @@ typedef struct { static void client_setup_transport(void *ts, grpc_transport *transport, grpc_mdctx *mdctx, - grpc_call_list *call_list) { + grpc_closure_list *closure_list) { sp_client_setup *cs = ts; const grpc_channel_filter *filters[] = {&grpc_http_client_filter, @@ -85,7 +85,7 @@ static void client_setup_transport(void *ts, grpc_transport *transport, size_t nfilters = sizeof(filters) / sizeof(*filters); grpc_channel *channel = grpc_channel_create_from_filters("socketpair-target", filters, nfilters, - cs->client_args, mdctx, 1, call_list); + cs->client_args, mdctx, 1, closure_list); cs->f->client = channel; @@ -109,7 +109,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_socketpair( static void chttp2_init_client_socketpair(grpc_end2end_test_fixture *f, grpc_channel_args *client_args) { - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; grpc_endpoint_pair *sfd = f->fixture_data; grpc_transport *transport; grpc_mdctx *mdctx = grpc_mdctx_create(); @@ -117,16 +117,16 @@ static void chttp2_init_client_socketpair(grpc_end2end_test_fixture *f, cs.client_args = client_args; cs.f = f; transport = grpc_create_chttp2_transport(client_args, sfd->client, mdctx, 1, - &call_list); - client_setup_transport(&cs, transport, mdctx, &call_list); + &closure_list); + client_setup_transport(&cs, transport, mdctx, &closure_list); GPR_ASSERT(f->client); - grpc_chttp2_transport_start_reading(transport, NULL, 0, &call_list); - grpc_call_list_run(&call_list); + grpc_chttp2_transport_start_reading(transport, NULL, 0, &closure_list); + grpc_closure_list_run(&closure_list); } static void chttp2_init_server_socketpair(grpc_end2end_test_fixture *f, grpc_channel_args *server_args) { - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; grpc_endpoint_pair *sfd = f->fixture_data; grpc_mdctx *mdctx = grpc_mdctx_create(); grpc_transport *transport; @@ -135,10 +135,10 @@ static void chttp2_init_server_socketpair(grpc_end2end_test_fixture *f, grpc_server_register_completion_queue(f->server, f->cq, NULL); grpc_server_start(f->server); transport = grpc_create_chttp2_transport(server_args, sfd->server, mdctx, 0, - &call_list); + &closure_list); server_setup_transport(f, transport, mdctx); - grpc_chttp2_transport_start_reading(transport, NULL, 0, &call_list); - grpc_call_list_run(&call_list); + grpc_chttp2_transport_start_reading(transport, NULL, 0, &closure_list); + grpc_closure_list_run(&closure_list); } static void chttp2_tear_down_socketpair(grpc_end2end_test_fixture *f) { @@ -154,7 +154,7 @@ static grpc_end2end_test_config configs[] = { int main(int argc, char **argv) { size_t i; - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; /* force tracing on, with a value to force many code paths in trace.c to be taken */ @@ -167,7 +167,7 @@ int main(int argc, char **argv) { grpc_test_init(argc, argv); grpc_init(); - grpc_call_list_run(&call_list); + grpc_closure_list_run(&closure_list); GPR_ASSERT(0 == grpc_tracer_set_enabled("also-doesnt-exist", 0)); GPR_ASSERT(1 == grpc_tracer_set_enabled("http", 1)); diff --git a/test/core/end2end/fixtures/h2_sockpair.c b/test/core/end2end/fixtures/h2_sockpair.c index 57fc986974..e927a0e0d8 100644 --- a/test/core/end2end/fixtures/h2_sockpair.c +++ b/test/core/end2end/fixtures/h2_sockpair.c @@ -61,11 +61,11 @@ static void server_setup_transport(void *ts, grpc_transport *transport, grpc_end2end_test_fixture *f = ts; static grpc_channel_filter const *extra_filters[] = { &grpc_http_server_filter}; - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; grpc_server_setup_transport( f->server, transport, extra_filters, GPR_ARRAY_SIZE(extra_filters), mdctx, - grpc_server_get_channel_args(f->server), &call_list); - grpc_call_list_run(&call_list); + grpc_server_get_channel_args(f->server), &closure_list); + grpc_closure_list_run(&closure_list); } typedef struct { @@ -75,7 +75,7 @@ typedef struct { static void client_setup_transport(void *ts, grpc_transport *transport, grpc_mdctx *mdctx, - grpc_call_list *call_list) { + grpc_closure_list *closure_list) { sp_client_setup *cs = ts; const grpc_channel_filter *filters[] = {&grpc_http_client_filter, @@ -84,7 +84,7 @@ static void client_setup_transport(void *ts, grpc_transport *transport, size_t nfilters = sizeof(filters) / sizeof(*filters); grpc_channel *channel = grpc_channel_create_from_filters("socketpair-target", filters, nfilters, - cs->client_args, mdctx, 1, call_list); + cs->client_args, mdctx, 1, closure_list); cs->f->client = channel; @@ -108,7 +108,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_socketpair( static void chttp2_init_client_socketpair(grpc_end2end_test_fixture *f, grpc_channel_args *client_args) { - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; grpc_endpoint_pair *sfd = f->fixture_data; grpc_transport *transport; grpc_mdctx *mdctx = grpc_mdctx_create(); @@ -116,16 +116,16 @@ static void chttp2_init_client_socketpair(grpc_end2end_test_fixture *f, cs.client_args = client_args; cs.f = f; transport = grpc_create_chttp2_transport(client_args, sfd->client, mdctx, 1, - &call_list); - client_setup_transport(&cs, transport, mdctx, &call_list); + &closure_list); + client_setup_transport(&cs, transport, mdctx, &closure_list); GPR_ASSERT(f->client); - grpc_chttp2_transport_start_reading(transport, NULL, 0, &call_list); - grpc_call_list_run(&call_list); + grpc_chttp2_transport_start_reading(transport, NULL, 0, &closure_list); + grpc_closure_list_run(&closure_list); } static void chttp2_init_server_socketpair(grpc_end2end_test_fixture *f, grpc_channel_args *server_args) { - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; grpc_endpoint_pair *sfd = f->fixture_data; grpc_mdctx *mdctx = grpc_mdctx_create(); grpc_transport *transport; @@ -134,10 +134,10 @@ static void chttp2_init_server_socketpair(grpc_end2end_test_fixture *f, grpc_server_register_completion_queue(f->server, f->cq, NULL); grpc_server_start(f->server); transport = grpc_create_chttp2_transport(server_args, sfd->server, mdctx, 0, - &call_list); + &closure_list); server_setup_transport(f, transport, mdctx); - grpc_chttp2_transport_start_reading(transport, NULL, 0, &call_list); - grpc_call_list_run(&call_list); + grpc_chttp2_transport_start_reading(transport, NULL, 0, &closure_list); + grpc_closure_list_run(&closure_list); } static void chttp2_tear_down_socketpair(grpc_end2end_test_fixture *f) { diff --git a/test/core/end2end/fixtures/h2_sockpair_1byte.c b/test/core/end2end/fixtures/h2_sockpair_1byte.c index d0c552a669..8a9196d3b6 100644 --- a/test/core/end2end/fixtures/h2_sockpair_1byte.c +++ b/test/core/end2end/fixtures/h2_sockpair_1byte.c @@ -61,11 +61,11 @@ static void server_setup_transport(void *ts, grpc_transport *transport, grpc_end2end_test_fixture *f = ts; static grpc_channel_filter const *extra_filters[] = { &grpc_http_server_filter}; - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; grpc_server_setup_transport( f->server, transport, extra_filters, GPR_ARRAY_SIZE(extra_filters), mdctx, - grpc_server_get_channel_args(f->server), &call_list); - grpc_call_list_run(&call_list); + grpc_server_get_channel_args(f->server), &closure_list); + grpc_closure_list_run(&closure_list); } typedef struct { @@ -75,7 +75,7 @@ typedef struct { static void client_setup_transport(void *ts, grpc_transport *transport, grpc_mdctx *mdctx, - grpc_call_list *call_list) { + grpc_closure_list *closure_list) { sp_client_setup *cs = ts; const grpc_channel_filter *filters[] = {&grpc_http_client_filter, @@ -84,7 +84,7 @@ static void client_setup_transport(void *ts, grpc_transport *transport, size_t nfilters = sizeof(filters) / sizeof(*filters); grpc_channel *channel = grpc_channel_create_from_filters("socketpair-target", filters, nfilters, - cs->client_args, mdctx, 1, call_list); + cs->client_args, mdctx, 1, closure_list); cs->f->client = channel; @@ -108,7 +108,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_socketpair( static void chttp2_init_client_socketpair(grpc_end2end_test_fixture *f, grpc_channel_args *client_args) { - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; grpc_endpoint_pair *sfd = f->fixture_data; grpc_transport *transport; grpc_mdctx *mdctx = grpc_mdctx_create(); @@ -116,16 +116,16 @@ static void chttp2_init_client_socketpair(grpc_end2end_test_fixture *f, cs.client_args = client_args; cs.f = f; transport = grpc_create_chttp2_transport(client_args, sfd->client, mdctx, 1, - &call_list); - client_setup_transport(&cs, transport, mdctx, &call_list); + &closure_list); + client_setup_transport(&cs, transport, mdctx, &closure_list); GPR_ASSERT(f->client); - grpc_chttp2_transport_start_reading(transport, NULL, 0, &call_list); - grpc_call_list_run(&call_list); + grpc_chttp2_transport_start_reading(transport, NULL, 0, &closure_list); + grpc_closure_list_run(&closure_list); } static void chttp2_init_server_socketpair(grpc_end2end_test_fixture *f, grpc_channel_args *server_args) { - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; grpc_endpoint_pair *sfd = f->fixture_data; grpc_mdctx *mdctx = grpc_mdctx_create(); grpc_transport *transport; @@ -134,10 +134,10 @@ static void chttp2_init_server_socketpair(grpc_end2end_test_fixture *f, grpc_server_register_completion_queue(f->server, f->cq, NULL); grpc_server_start(f->server); transport = grpc_create_chttp2_transport(server_args, sfd->server, mdctx, 0, - &call_list); + &closure_list); server_setup_transport(f, transport, mdctx); - grpc_chttp2_transport_start_reading(transport, NULL, 0, &call_list); - grpc_call_list_run(&call_list); + grpc_chttp2_transport_start_reading(transport, NULL, 0, &closure_list); + grpc_closure_list_run(&closure_list); } static void chttp2_tear_down_socketpair(grpc_end2end_test_fixture *f) { diff --git a/test/core/httpcli/httpcli_test.c b/test/core/httpcli/httpcli_test.c index bcb544e502..063565ecfc 100644 --- a/test/core/httpcli/httpcli_test.c +++ b/test/core/httpcli/httpcli_test.c @@ -54,7 +54,7 @@ static gpr_timespec n_seconds_time(int seconds) { } static void on_finish(void *arg, const grpc_httpcli_response *response, - grpc_call_list *call_list) { + grpc_closure_list *closure_list) { const char *expect = "<html><head><title>Hello world!</title></head>" "<body><p>This is a test</p></body></html>"; @@ -72,7 +72,7 @@ static void on_finish(void *arg, const grpc_httpcli_response *response, static void test_get(int use_ssl, int port) { grpc_httpcli_request req; char *host; - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; g_done = 0; gpr_log(GPR_INFO, "running %s with use_ssl=%d.", "test_get", use_ssl); @@ -86,14 +86,14 @@ static void test_get(int use_ssl, int port) { req.handshaker = use_ssl ? &grpc_httpcli_ssl : &grpc_httpcli_plaintext; grpc_httpcli_get(&g_context, &g_pollset, &req, n_seconds_time(15), on_finish, - (void *)42, &call_list); + (void *)42, &closure_list); gpr_mu_lock(GRPC_POLLSET_MU(&g_pollset)); while (!g_done) { grpc_pollset_worker worker; grpc_pollset_work(&g_pollset, &worker, gpr_now(GPR_CLOCK_MONOTONIC), - n_seconds_time(20), &call_list); + n_seconds_time(20), &closure_list); gpr_mu_unlock(GRPC_POLLSET_MU(&g_pollset)); - grpc_call_list_run(&call_list); + grpc_closure_list_run(&closure_list); gpr_mu_lock(GRPC_POLLSET_MU(&g_pollset)); } gpr_mu_unlock(GRPC_POLLSET_MU(&g_pollset)); @@ -103,7 +103,7 @@ static void test_get(int use_ssl, int port) { static void test_post(int use_ssl, int port) { grpc_httpcli_request req; char *host; - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; g_done = 0; gpr_log(GPR_INFO, "running %s with use_ssl=%d.", "test_post", (int)use_ssl); @@ -117,27 +117,28 @@ static void test_post(int use_ssl, int port) { req.handshaker = use_ssl ? &grpc_httpcli_ssl : &grpc_httpcli_plaintext; grpc_httpcli_post(&g_context, &g_pollset, &req, "hello", 5, - n_seconds_time(15), on_finish, (void *)42, &call_list); + n_seconds_time(15), on_finish, (void *)42, &closure_list); gpr_mu_lock(GRPC_POLLSET_MU(&g_pollset)); while (!g_done) { grpc_pollset_worker worker; grpc_pollset_work(&g_pollset, &worker, gpr_now(GPR_CLOCK_MONOTONIC), - n_seconds_time(20), &call_list); + n_seconds_time(20), &closure_list); gpr_mu_unlock(GRPC_POLLSET_MU(&g_pollset)); - grpc_call_list_run(&call_list); + grpc_closure_list_run(&closure_list); gpr_mu_lock(GRPC_POLLSET_MU(&g_pollset)); } gpr_mu_unlock(GRPC_POLLSET_MU(&g_pollset)); gpr_free(host); } -static void destroy_pollset(void *p, int success, grpc_call_list *call_list) { +static void destroy_pollset(void *p, int success, + grpc_closure_list *closure_list) { grpc_pollset_destroy(p); } int main(int argc, char **argv) { grpc_closure destroyed; - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; gpr_subprocess *server; char *me = argv[0]; char *lslash = strrchr(me, '/'); @@ -175,8 +176,8 @@ int main(int argc, char **argv) { grpc_httpcli_context_destroy(&g_context); grpc_closure_init(&destroyed, destroy_pollset, &g_pollset); - grpc_pollset_shutdown(&g_pollset, &destroyed, &call_list); - grpc_call_list_run(&call_list); + grpc_pollset_shutdown(&g_pollset, &destroyed, &closure_list); + grpc_closure_list_run(&closure_list); grpc_shutdown(); gpr_subprocess_destroy(server); diff --git a/test/core/iomgr/alarm_list_test.c b/test/core/iomgr/alarm_list_test.c index 8082532434..90ff49cb8f 100644 --- a/test/core/iomgr/alarm_list_test.c +++ b/test/core/iomgr/alarm_list_test.c @@ -43,7 +43,7 @@ static int cb_called[MAX_CB][2]; -static void cb(void *arg, int success, grpc_call_list *call_list) { +static void cb(void *arg, int success, grpc_closure_list *closure_list) { cb_called[(gpr_intptr)arg][success]++; } @@ -51,7 +51,7 @@ static void add_test(void) { gpr_timespec start = gpr_now(GPR_CLOCK_REALTIME); int i; grpc_alarm alarms[20]; - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; grpc_alarm_list_init(start); memset(cb_called, 0, sizeof(cb_called)); @@ -60,21 +60,21 @@ static void add_test(void) { for (i = 0; i < 10; i++) { grpc_alarm_init(&alarms[i], gpr_time_add(start, gpr_time_from_millis(10, GPR_TIMESPAN)), - cb, (void *)(gpr_intptr)i, start, &call_list); + cb, (void *)(gpr_intptr)i, start, &closure_list); } /* 1010 ms alarms. will expire in the next epoch */ for (i = 10; i < 20; i++) { grpc_alarm_init(&alarms[i], gpr_time_add(start, gpr_time_from_millis( 1010, GPR_TIMESPAN)), - cb, (void *)(gpr_intptr)i, start, &call_list); + cb, (void *)(gpr_intptr)i, start, &closure_list); } /* collect alarms. Only the first batch should be ready. */ GPR_ASSERT(10 == grpc_alarm_check(gpr_time_add(start, gpr_time_from_millis( 500, GPR_TIMESPAN)), - NULL, &call_list)); - grpc_call_list_run(&call_list); + NULL, &closure_list)); + grpc_closure_list_run(&closure_list); for (i = 0; i < 20; i++) { GPR_ASSERT(cb_called[i][1] == (i < 10)); GPR_ASSERT(cb_called[i][0] == 0); @@ -82,8 +82,8 @@ static void add_test(void) { GPR_ASSERT(0 == grpc_alarm_check(gpr_time_add(start, gpr_time_from_millis( 600, GPR_TIMESPAN)), - NULL, &call_list)); - grpc_call_list_run(&call_list); + NULL, &closure_list)); + grpc_closure_list_run(&closure_list); for (i = 0; i < 30; i++) { GPR_ASSERT(cb_called[i][1] == (i < 10)); GPR_ASSERT(cb_called[i][0] == 0); @@ -93,8 +93,8 @@ static void add_test(void) { GPR_ASSERT(10 == grpc_alarm_check( gpr_time_add(start, gpr_time_from_millis(1500, GPR_TIMESPAN)), - NULL, &call_list)); - grpc_call_list_run(&call_list); + NULL, &closure_list)); + grpc_closure_list_run(&closure_list); for (i = 0; i < 30; i++) { GPR_ASSERT(cb_called[i][1] == (i < 20)); GPR_ASSERT(cb_called[i][0] == 0); @@ -102,14 +102,14 @@ static void add_test(void) { GPR_ASSERT(0 == grpc_alarm_check(gpr_time_add(start, gpr_time_from_millis( 1600, GPR_TIMESPAN)), - NULL, &call_list)); + NULL, &closure_list)); for (i = 0; i < 30; i++) { GPR_ASSERT(cb_called[i][1] == (i < 20)); GPR_ASSERT(cb_called[i][0] == 0); } - grpc_alarm_list_shutdown(&call_list); - grpc_call_list_run(&call_list); + grpc_alarm_list_shutdown(&closure_list); + grpc_closure_list_run(&closure_list); } static gpr_timespec tfm(int m) { @@ -121,32 +121,32 @@ static gpr_timespec tfm(int m) { /* Cleaning up a list with pending alarms. */ void destruction_test(void) { grpc_alarm alarms[5]; - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; grpc_alarm_list_init(gpr_time_0(GPR_CLOCK_REALTIME)); memset(cb_called, 0, sizeof(cb_called)); grpc_alarm_init(&alarms[0], tfm(100), cb, (void *)(gpr_intptr)0, - gpr_time_0(GPR_CLOCK_REALTIME), &call_list); + gpr_time_0(GPR_CLOCK_REALTIME), &closure_list); grpc_alarm_init(&alarms[1], tfm(3), cb, (void *)(gpr_intptr)1, - gpr_time_0(GPR_CLOCK_REALTIME), &call_list); + gpr_time_0(GPR_CLOCK_REALTIME), &closure_list); grpc_alarm_init(&alarms[2], tfm(100), cb, (void *)(gpr_intptr)2, - gpr_time_0(GPR_CLOCK_REALTIME), &call_list); + gpr_time_0(GPR_CLOCK_REALTIME), &closure_list); grpc_alarm_init(&alarms[3], tfm(3), cb, (void *)(gpr_intptr)3, - gpr_time_0(GPR_CLOCK_REALTIME), &call_list); + gpr_time_0(GPR_CLOCK_REALTIME), &closure_list); grpc_alarm_init(&alarms[4], tfm(1), cb, (void *)(gpr_intptr)4, - gpr_time_0(GPR_CLOCK_REALTIME), &call_list); - GPR_ASSERT(1 == grpc_alarm_check(tfm(2), NULL, &call_list)); - grpc_call_list_run(&call_list); + gpr_time_0(GPR_CLOCK_REALTIME), &closure_list); + GPR_ASSERT(1 == grpc_alarm_check(tfm(2), NULL, &closure_list)); + grpc_closure_list_run(&closure_list); GPR_ASSERT(1 == cb_called[4][1]); - grpc_alarm_cancel(&alarms[0], &call_list); - grpc_alarm_cancel(&alarms[3], &call_list); - grpc_call_list_run(&call_list); + grpc_alarm_cancel(&alarms[0], &closure_list); + grpc_alarm_cancel(&alarms[3], &closure_list); + grpc_closure_list_run(&closure_list); GPR_ASSERT(1 == cb_called[0][0]); GPR_ASSERT(1 == cb_called[3][0]); - grpc_alarm_list_shutdown(&call_list); - grpc_call_list_run(&call_list); + grpc_alarm_list_shutdown(&closure_list); + grpc_closure_list_run(&closure_list); GPR_ASSERT(1 == cb_called[1][0]); GPR_ASSERT(1 == cb_called[2][0]); } diff --git a/test/core/iomgr/endpoint_pair_test.c b/test/core/iomgr/endpoint_pair_test.c index 491effd5ae..32c715c428 100644 --- a/test/core/iomgr/endpoint_pair_test.c +++ b/test/core/iomgr/endpoint_pair_test.c @@ -48,15 +48,15 @@ static void clean_up(void) {} static grpc_endpoint_test_fixture create_fixture_endpoint_pair( size_t slice_size) { - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; grpc_endpoint_test_fixture f; grpc_endpoint_pair p = grpc_iomgr_create_endpoint_pair("test", slice_size); f.client_ep = p.client; f.server_ep = p.server; - grpc_endpoint_add_to_pollset(f.client_ep, &g_pollset, &call_list); - grpc_endpoint_add_to_pollset(f.server_ep, &g_pollset, &call_list); - grpc_call_list_run(&call_list); + grpc_endpoint_add_to_pollset(f.client_ep, &g_pollset, &closure_list); + grpc_endpoint_add_to_pollset(f.server_ep, &g_pollset, &closure_list); + grpc_closure_list_run(&closure_list); return f; } @@ -65,20 +65,21 @@ static grpc_endpoint_test_config configs[] = { {"tcp/tcp_socketpair", create_fixture_endpoint_pair, clean_up}, }; -static void destroy_pollset(void *p, int success, grpc_call_list *call_list) { +static void destroy_pollset(void *p, int success, + grpc_closure_list *closure_list) { grpc_pollset_destroy(p); } int main(int argc, char **argv) { grpc_closure destroyed; - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; grpc_test_init(argc, argv); grpc_init(); grpc_pollset_init(&g_pollset); grpc_endpoint_tests(configs[0], &g_pollset); grpc_closure_init(&destroyed, destroy_pollset, &g_pollset); - grpc_pollset_shutdown(&g_pollset, &destroyed, &call_list); - grpc_call_list_run(&call_list); + grpc_pollset_shutdown(&g_pollset, &destroyed, &closure_list); + grpc_closure_list_run(&closure_list); grpc_shutdown(); return 0; diff --git a/test/core/iomgr/endpoint_tests.c b/test/core/iomgr/endpoint_tests.c index 31743167cd..e106881d91 100644 --- a/test/core/iomgr/endpoint_tests.c +++ b/test/core/iomgr/endpoint_tests.c @@ -127,7 +127,7 @@ struct read_and_write_test_state { }; static void read_and_write_test_read_handler(void *data, int success, - grpc_call_list *call_list) { + grpc_closure_list *closure_list) { struct read_and_write_test_state *state = data; state->bytes_read += count_slices( @@ -140,12 +140,12 @@ static void read_and_write_test_read_handler(void *data, int success, gpr_mu_unlock(GRPC_POLLSET_MU(g_pollset)); } else if (success) { grpc_endpoint_read(state->read_ep, &state->incoming, &state->done_read, - call_list); + closure_list); } } static void read_and_write_test_write_handler(void *data, int success, - grpc_call_list *call_list) { + grpc_closure_list *closure_list) { struct read_and_write_test_state *state = data; gpr_slice *slices = NULL; size_t nslices; @@ -162,7 +162,7 @@ static void read_and_write_test_write_handler(void *data, int success, gpr_slice_buffer_reset_and_unref(&state->outgoing); gpr_slice_buffer_addn(&state->outgoing, slices, nslices); grpc_endpoint_write(state->write_ep, &state->outgoing, &state->done_write, - call_list); + closure_list); free(slices); return; } @@ -186,7 +186,7 @@ static void read_and_write_test(grpc_endpoint_test_config config, gpr_timespec deadline = GRPC_TIMEOUT_SECONDS_TO_DEADLINE(20); grpc_endpoint_test_fixture f = begin_test(config, "read_and_write_test", slice_size); - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; gpr_log(GPR_DEBUG, "num_bytes=%d write_size=%d slice_size=%d shutdown=%d", num_bytes, write_size, slice_size, shutdown); @@ -218,36 +218,36 @@ static void read_and_write_test(grpc_endpoint_test_config config, for the first iteration as for later iterations. It does the right thing even when bytes_written is unsigned. */ state.bytes_written -= state.current_write_size; - read_and_write_test_write_handler(&state, 1, &call_list); - grpc_call_list_run(&call_list); + read_and_write_test_write_handler(&state, 1, &closure_list); + grpc_closure_list_run(&closure_list); grpc_endpoint_read(state.read_ep, &state.incoming, &state.done_read, - &call_list); + &closure_list); if (shutdown) { gpr_log(GPR_DEBUG, "shutdown read"); - grpc_endpoint_shutdown(state.read_ep, &call_list); + grpc_endpoint_shutdown(state.read_ep, &closure_list); gpr_log(GPR_DEBUG, "shutdown write"); - grpc_endpoint_shutdown(state.write_ep, &call_list); + grpc_endpoint_shutdown(state.write_ep, &closure_list); } - grpc_call_list_run(&call_list); + grpc_closure_list_run(&closure_list); gpr_mu_lock(GRPC_POLLSET_MU(g_pollset)); while (!state.read_done || !state.write_done) { grpc_pollset_worker worker; GPR_ASSERT(gpr_time_cmp(gpr_now(GPR_CLOCK_MONOTONIC), deadline) < 0); grpc_pollset_work(g_pollset, &worker, gpr_now(GPR_CLOCK_MONOTONIC), - deadline, &call_list); + deadline, &closure_list); } gpr_mu_unlock(GRPC_POLLSET_MU(g_pollset)); - grpc_call_list_run(&call_list); + grpc_closure_list_run(&closure_list); end_test(config); gpr_slice_buffer_destroy(&state.outgoing); gpr_slice_buffer_destroy(&state.incoming); - grpc_endpoint_destroy(state.read_ep, &call_list); - grpc_endpoint_destroy(state.write_ep, &call_list); - grpc_call_list_run(&call_list); + grpc_endpoint_destroy(state.read_ep, &closure_list); + grpc_endpoint_destroy(state.write_ep, &closure_list); + grpc_closure_list_run(&closure_list); } void grpc_endpoint_tests(grpc_endpoint_test_config config, diff --git a/test/core/iomgr/fd_conservation_posix_test.c b/test/core/iomgr/fd_conservation_posix_test.c index a1b1171b07..1ffb5808b7 100644 --- a/test/core/iomgr/fd_conservation_posix_test.c +++ b/test/core/iomgr/fd_conservation_posix_test.c @@ -54,11 +54,11 @@ int main(int argc, char **argv) { GPR_ASSERT(0 == setrlimit(RLIMIT_NOFILE, &rlim)); for (i = 0; i < 100; i++) { - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; p = grpc_iomgr_create_endpoint_pair("test", 1); - grpc_endpoint_destroy(p.client, &call_list); - grpc_endpoint_destroy(p.server, &call_list); - grpc_call_list_run(&call_list); + grpc_endpoint_destroy(p.client, &closure_list); + grpc_endpoint_destroy(p.server, &closure_list); + grpc_closure_list_run(&closure_list); } grpc_iomgr_shutdown(); diff --git a/test/core/iomgr/fd_posix_test.c b/test/core/iomgr/fd_posix_test.c index f89d6c7824..0a8d40419b 100644 --- a/test/core/iomgr/fd_posix_test.c +++ b/test/core/iomgr/fd_posix_test.c @@ -118,18 +118,18 @@ typedef struct { /* Called when an upload session can be safely shutdown. Close session FD and start to shutdown listen FD. */ static void session_shutdown_cb(void *arg, /*session*/ - int success, grpc_call_list *call_list) { + int success, grpc_closure_list *closure_list) { session *se = arg; server *sv = se->sv; - grpc_fd_orphan(se->em_fd, NULL, "a", call_list); + grpc_fd_orphan(se->em_fd, NULL, "a", closure_list); gpr_free(se); /* Start to shutdown listen fd. */ - grpc_fd_shutdown(sv->em_fd, call_list); + grpc_fd_shutdown(sv->em_fd, closure_list); } /* Called when data become readable in a session. */ static void session_read_cb(void *arg, /*session*/ - int success, grpc_call_list *call_list) { + int success, grpc_closure_list *closure_list) { session *se = arg; int fd = se->em_fd->fd; @@ -137,7 +137,7 @@ static void session_read_cb(void *arg, /*session*/ ssize_t read_total = 0; if (!success) { - session_shutdown_cb(arg, 1, call_list); + session_shutdown_cb(arg, 1, closure_list); return; } @@ -152,7 +152,7 @@ static void session_read_cb(void *arg, /*session*/ It is possible to read nothing due to spurious edge event or data has been drained, In such a case, read() returns -1 and set errno to EAGAIN. */ if (read_once == 0) { - session_shutdown_cb(arg, 1, call_list); + session_shutdown_cb(arg, 1, closure_list); } else if (read_once == -1) { if (errno == EAGAIN) { /* An edge triggered event is cached in the kernel until next poll. @@ -163,7 +163,8 @@ static void session_read_cb(void *arg, /*session*/ TODO(chenw): in multi-threaded version, callback and polling can be run in different threads. polling may catch a persist read edge event before notify_on_read is called. */ - grpc_fd_notify_on_read(se->em_fd, &se->session_read_closure, call_list); + grpc_fd_notify_on_read(se->em_fd, &se->session_read_closure, + closure_list); } else { gpr_log(GPR_ERROR, "Unhandled read error %s", strerror(errno)); abort(); @@ -174,10 +175,10 @@ static void session_read_cb(void *arg, /*session*/ /* Called when the listen FD can be safely shutdown. Close listen FD and signal that server can be shutdown. */ static void listen_shutdown_cb(void *arg /*server*/, int success, - grpc_call_list *call_list) { + grpc_closure_list *closure_list) { server *sv = arg; - grpc_fd_orphan(sv->em_fd, NULL, "b", call_list); + grpc_fd_orphan(sv->em_fd, NULL, "b", closure_list); gpr_mu_lock(GRPC_POLLSET_MU(&g_pollset)); sv->done = 1; @@ -187,7 +188,7 @@ static void listen_shutdown_cb(void *arg /*server*/, int success, /* Called when a new TCP connection request arrives in the listening port. */ static void listen_cb(void *arg, /*=sv_arg*/ - int success, grpc_call_list *call_list) { + int success, grpc_closure_list *closure_list) { server *sv = arg; int fd; int flags; @@ -197,7 +198,7 @@ static void listen_cb(void *arg, /*=sv_arg*/ grpc_fd *listen_em_fd = sv->em_fd; if (!success) { - listen_shutdown_cb(arg, 1, call_list); + listen_shutdown_cb(arg, 1, closure_list); return; } @@ -209,12 +210,12 @@ static void listen_cb(void *arg, /*=sv_arg*/ se = gpr_malloc(sizeof(*se)); se->sv = sv; se->em_fd = grpc_fd_create(fd, "listener"); - grpc_pollset_add_fd(&g_pollset, se->em_fd, call_list); + grpc_pollset_add_fd(&g_pollset, se->em_fd, closure_list); se->session_read_closure.cb = session_read_cb; se->session_read_closure.cb_arg = se; - grpc_fd_notify_on_read(se->em_fd, &se->session_read_closure, call_list); + grpc_fd_notify_on_read(se->em_fd, &se->session_read_closure, closure_list); - grpc_fd_notify_on_read(listen_em_fd, &sv->listen_closure, call_list); + grpc_fd_notify_on_read(listen_em_fd, &sv->listen_closure, closure_list); } /* Max number of connections pending to be accepted by listen(). */ @@ -224,7 +225,7 @@ static void listen_cb(void *arg, /*=sv_arg*/ listen_cb() is registered to be interested in reading from listen_fd. When connection request arrives, listen_cb() is called to accept the connection request. */ -static int server_start(server *sv, grpc_call_list *call_list) { +static int server_start(server *sv, grpc_closure_list *closure_list) { int port = 0; int fd; struct sockaddr_in sin; @@ -238,11 +239,11 @@ static int server_start(server *sv, grpc_call_list *call_list) { GPR_ASSERT(listen(fd, MAX_NUM_FD) == 0); sv->em_fd = grpc_fd_create(fd, "server"); - grpc_pollset_add_fd(&g_pollset, sv->em_fd, call_list); + grpc_pollset_add_fd(&g_pollset, sv->em_fd, closure_list); /* Register to be interested in reading from listen_fd. */ sv->listen_closure.cb = listen_cb; sv->listen_closure.cb_arg = sv; - grpc_fd_notify_on_read(sv->em_fd, &sv->listen_closure, call_list); + grpc_fd_notify_on_read(sv->em_fd, &sv->listen_closure, closure_list); return port; } @@ -251,12 +252,12 @@ static int server_start(server *sv, grpc_call_list *call_list) { static void server_wait_and_shutdown(server *sv) { gpr_mu_lock(GRPC_POLLSET_MU(&g_pollset)); while (!sv->done) { - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; grpc_pollset_worker worker; grpc_pollset_work(&g_pollset, &worker, gpr_now(GPR_CLOCK_MONOTONIC), - gpr_inf_future(GPR_CLOCK_MONOTONIC), &call_list); + gpr_inf_future(GPR_CLOCK_MONOTONIC), &closure_list); gpr_mu_unlock(GRPC_POLLSET_MU(&g_pollset)); - grpc_call_list_run(&call_list); + grpc_closure_list_run(&closure_list); gpr_mu_lock(GRPC_POLLSET_MU(&g_pollset)); } gpr_mu_unlock(GRPC_POLLSET_MU(&g_pollset)); @@ -291,23 +292,23 @@ static void client_init(client *cl) { /* Called when a client upload session is ready to shutdown. */ static void client_session_shutdown_cb(void *arg /*client*/, int success, - grpc_call_list *call_list) { + grpc_closure_list *closure_list) { client *cl = arg; - grpc_fd_orphan(cl->em_fd, NULL, "c", call_list); + grpc_fd_orphan(cl->em_fd, NULL, "c", closure_list); cl->done = 1; grpc_pollset_kick(&g_pollset, NULL); } /* Write as much as possible, then register notify_on_write. */ static void client_session_write(void *arg, /*client*/ - int success, grpc_call_list *call_list) { + int success, grpc_closure_list *closure_list) { client *cl = arg; int fd = cl->em_fd->fd; ssize_t write_once = 0; if (!success) { gpr_mu_lock(GRPC_POLLSET_MU(&g_pollset)); - client_session_shutdown_cb(arg, 1, call_list); + client_session_shutdown_cb(arg, 1, closure_list); gpr_mu_unlock(GRPC_POLLSET_MU(&g_pollset)); return; } @@ -322,10 +323,10 @@ static void client_session_write(void *arg, /*client*/ if (cl->client_write_cnt < CLIENT_TOTAL_WRITE_CNT) { cl->write_closure.cb = client_session_write; cl->write_closure.cb_arg = cl; - grpc_fd_notify_on_write(cl->em_fd, &cl->write_closure, call_list); + grpc_fd_notify_on_write(cl->em_fd, &cl->write_closure, closure_list); cl->client_write_cnt++; } else { - client_session_shutdown_cb(arg, 1, call_list); + client_session_shutdown_cb(arg, 1, closure_list); } gpr_mu_unlock(GRPC_POLLSET_MU(&g_pollset)); } else { @@ -335,7 +336,8 @@ static void client_session_write(void *arg, /*client*/ } /* Start a client to send a stream of bytes. */ -static void client_start(client *cl, int port, grpc_call_list *call_list) { +static void client_start(client *cl, int port, + grpc_closure_list *closure_list) { int fd; struct sockaddr_in sin; create_test_socket(port, &fd, &sin); @@ -356,9 +358,9 @@ static void client_start(client *cl, int port, grpc_call_list *call_list) { } cl->em_fd = grpc_fd_create(fd, "client"); - grpc_pollset_add_fd(&g_pollset, cl->em_fd, call_list); + grpc_pollset_add_fd(&g_pollset, cl->em_fd, closure_list); - client_session_write(cl, 1, call_list); + client_session_write(cl, 1, closure_list); } /* Wait for the signal to shutdown a client. */ @@ -366,11 +368,11 @@ static void client_wait_and_shutdown(client *cl) { gpr_mu_lock(GRPC_POLLSET_MU(&g_pollset)); while (!cl->done) { grpc_pollset_worker worker; - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; grpc_pollset_work(&g_pollset, &worker, gpr_now(GPR_CLOCK_MONOTONIC), - gpr_inf_future(GPR_CLOCK_MONOTONIC), &call_list); + gpr_inf_future(GPR_CLOCK_MONOTONIC), &closure_list); gpr_mu_unlock(GRPC_POLLSET_MU(&g_pollset)); - grpc_call_list_run(&call_list); + grpc_closure_list_run(&closure_list); gpr_mu_lock(GRPC_POLLSET_MU(&g_pollset)); } gpr_mu_unlock(GRPC_POLLSET_MU(&g_pollset)); @@ -383,13 +385,13 @@ static void test_grpc_fd(void) { server sv; client cl; int port; - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; server_init(&sv); - port = server_start(&sv, &call_list); + port = server_start(&sv, &closure_list); client_init(&cl); - client_start(&cl, port, &call_list); - grpc_call_list_run(&call_list); + client_start(&cl, port, &closure_list); + grpc_closure_list_run(&closure_list); client_wait_and_shutdown(&cl); server_wait_and_shutdown(&sv); GPR_ASSERT(sv.read_bytes_total == cl.write_bytes_total); @@ -397,7 +399,7 @@ static void test_grpc_fd(void) { } typedef struct fd_change_data { - void (*cb_that_ran)(void *, int success, grpc_call_list *call_list); + void (*cb_that_ran)(void *, int success, grpc_closure_list *closure_list); } fd_change_data; void init_change_data(fd_change_data *fdc) { fdc->cb_that_ran = NULL; } @@ -405,7 +407,7 @@ void init_change_data(fd_change_data *fdc) { fdc->cb_that_ran = NULL; } void destroy_change_data(fd_change_data *fdc) {} static void first_read_callback(void *arg /* fd_change_data */, int success, - grpc_call_list *call_list) { + grpc_closure_list *closure_list) { fd_change_data *fdc = arg; gpr_mu_lock(GRPC_POLLSET_MU(&g_pollset)); @@ -415,7 +417,7 @@ static void first_read_callback(void *arg /* fd_change_data */, int success, } static void second_read_callback(void *arg /* fd_change_data */, int success, - grpc_call_list *call_list) { + grpc_closure_list *closure_list) { fd_change_data *fdc = arg; gpr_mu_lock(GRPC_POLLSET_MU(&g_pollset)); @@ -437,7 +439,7 @@ static void test_grpc_fd_change(void) { ssize_t result; grpc_closure first_closure; grpc_closure second_closure; - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; first_closure.cb = first_read_callback; first_closure.cb_arg = &a; @@ -454,10 +456,10 @@ static void test_grpc_fd_change(void) { GPR_ASSERT(fcntl(sv[1], F_SETFL, flags | O_NONBLOCK) == 0); em_fd = grpc_fd_create(sv[0], "test_grpc_fd_change"); - grpc_pollset_add_fd(&g_pollset, em_fd, &call_list); + grpc_pollset_add_fd(&g_pollset, em_fd, &closure_list); /* Register the first callback, then make its FD readable */ - grpc_fd_notify_on_read(em_fd, &first_closure, &call_list); + grpc_fd_notify_on_read(em_fd, &first_closure, &closure_list); data = 0; result = write(sv[1], &data, 1); GPR_ASSERT(result == 1); @@ -467,9 +469,9 @@ static void test_grpc_fd_change(void) { while (a.cb_that_ran == NULL) { grpc_pollset_worker worker; grpc_pollset_work(&g_pollset, &worker, gpr_now(GPR_CLOCK_MONOTONIC), - gpr_inf_future(GPR_CLOCK_MONOTONIC), &call_list); + gpr_inf_future(GPR_CLOCK_MONOTONIC), &closure_list); gpr_mu_unlock(GRPC_POLLSET_MU(&g_pollset)); - grpc_call_list_run(&call_list); + grpc_closure_list_run(&closure_list); gpr_mu_lock(GRPC_POLLSET_MU(&g_pollset)); } GPR_ASSERT(a.cb_that_ran == first_read_callback); @@ -481,7 +483,7 @@ static void test_grpc_fd_change(void) { /* Now register a second callback with distinct change data, and do the same thing again. */ - grpc_fd_notify_on_read(em_fd, &second_closure, &call_list); + grpc_fd_notify_on_read(em_fd, &second_closure, &closure_list); data = 0; result = write(sv[1], &data, 1); GPR_ASSERT(result == 1); @@ -490,37 +492,38 @@ static void test_grpc_fd_change(void) { while (b.cb_that_ran == NULL) { grpc_pollset_worker worker; grpc_pollset_work(&g_pollset, &worker, gpr_now(GPR_CLOCK_MONOTONIC), - gpr_inf_future(GPR_CLOCK_MONOTONIC), &call_list); + gpr_inf_future(GPR_CLOCK_MONOTONIC), &closure_list); gpr_mu_unlock(GRPC_POLLSET_MU(&g_pollset)); - grpc_call_list_run(&call_list); + grpc_closure_list_run(&closure_list); gpr_mu_lock(GRPC_POLLSET_MU(&g_pollset)); } /* Except now we verify that second_read_callback ran instead */ GPR_ASSERT(b.cb_that_ran == second_read_callback); gpr_mu_unlock(GRPC_POLLSET_MU(&g_pollset)); - grpc_fd_orphan(em_fd, NULL, "d", &call_list); - grpc_call_list_run(&call_list); + grpc_fd_orphan(em_fd, NULL, "d", &closure_list); + grpc_closure_list_run(&closure_list); destroy_change_data(&a); destroy_change_data(&b); close(sv[1]); } -static void destroy_pollset(void *p, int success, grpc_call_list *call_list) { +static void destroy_pollset(void *p, int success, + grpc_closure_list *closure_list) { grpc_pollset_destroy(p); } int main(int argc, char **argv) { grpc_closure destroyed; - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; grpc_test_init(argc, argv); grpc_iomgr_init(); grpc_pollset_init(&g_pollset); test_grpc_fd(); test_grpc_fd_change(); grpc_closure_init(&destroyed, destroy_pollset, &g_pollset); - grpc_pollset_shutdown(&g_pollset, &destroyed, &call_list); - grpc_call_list_run(&call_list); + grpc_pollset_shutdown(&g_pollset, &destroyed, &closure_list); + grpc_closure_list_run(&closure_list); grpc_iomgr_shutdown(); return 0; } diff --git a/test/core/iomgr/resolve_address_test.c b/test/core/iomgr/resolve_address_test.c index 2ea3b56ee6..4d41020768 100644 --- a/test/core/iomgr/resolve_address_test.c +++ b/test/core/iomgr/resolve_address_test.c @@ -43,7 +43,7 @@ static gpr_timespec test_deadline(void) { } static void must_succeed(void* evp, grpc_resolved_addresses* p, - grpc_call_list* call_list) { + grpc_closure_list* closure_list) { GPR_ASSERT(p); GPR_ASSERT(p->naddrs >= 1); grpc_resolved_addresses_destroy(p); @@ -51,7 +51,7 @@ static void must_succeed(void* evp, grpc_resolved_addresses* p, } static void must_fail(void* evp, grpc_resolved_addresses* p, - grpc_call_list* call_list) { + grpc_closure_list* closure_list) { GPR_ASSERT(!p); gpr_event_set(evp, (void*)1); } diff --git a/test/core/iomgr/tcp_client_posix_test.c b/test/core/iomgr/tcp_client_posix_test.c index 0dd752d841..436e5cf7df 100644 --- a/test/core/iomgr/tcp_client_posix_test.c +++ b/test/core/iomgr/tcp_client_posix_test.c @@ -63,16 +63,17 @@ static void finish_connection() { gpr_mu_unlock(GRPC_POLLSET_MU(&g_pollset)); } -static void must_succeed(void *arg, int success, grpc_call_list *call_list) { +static void must_succeed(void *arg, int success, + grpc_closure_list *closure_list) { GPR_ASSERT(g_connecting != NULL); GPR_ASSERT(success); - grpc_endpoint_shutdown(g_connecting, call_list); - grpc_endpoint_destroy(g_connecting, call_list); + grpc_endpoint_shutdown(g_connecting, closure_list); + grpc_endpoint_destroy(g_connecting, closure_list); g_connecting = NULL; finish_connection(); } -static void must_fail(void *arg, int success, grpc_call_list *call_list) { +static void must_fail(void *arg, int success, grpc_closure_list *closure_list) { GPR_ASSERT(g_connecting == NULL); GPR_ASSERT(!success); finish_connection(); @@ -85,7 +86,7 @@ void test_succeeds(void) { int r; int connections_complete_before; grpc_closure done; - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; gpr_log(GPR_DEBUG, "test_succeeds"); @@ -107,7 +108,7 @@ void test_succeeds(void) { grpc_closure_init(&done, must_succeed, NULL); grpc_tcp_client_connect(&done, &g_connecting, &g_pollset_set, (struct sockaddr *)&addr, addr_len, - gpr_inf_future(GPR_CLOCK_REALTIME), &call_list); + gpr_inf_future(GPR_CLOCK_REALTIME), &closure_list); /* await the connection */ do { @@ -122,9 +123,9 @@ void test_succeeds(void) { while (g_connections_complete == connections_complete_before) { grpc_pollset_worker worker; grpc_pollset_work(&g_pollset, &worker, gpr_now(GPR_CLOCK_MONOTONIC), - GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), &call_list); + GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), &closure_list); gpr_mu_unlock(GRPC_POLLSET_MU(&g_pollset)); - grpc_call_list_run(&call_list); + grpc_closure_list_run(&closure_list); gpr_mu_lock(GRPC_POLLSET_MU(&g_pollset)); } @@ -136,7 +137,7 @@ void test_fails(void) { socklen_t addr_len = sizeof(addr); int connections_complete_before; grpc_closure done; - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; gpr_log(GPR_DEBUG, "test_fails"); @@ -151,7 +152,7 @@ void test_fails(void) { grpc_closure_init(&done, must_fail, NULL); grpc_tcp_client_connect(&done, &g_connecting, &g_pollset_set, (struct sockaddr *)&addr, addr_len, - gpr_inf_future(GPR_CLOCK_REALTIME), &call_list); + gpr_inf_future(GPR_CLOCK_REALTIME), &closure_list); gpr_mu_lock(GRPC_POLLSET_MU(&g_pollset)); @@ -159,9 +160,9 @@ void test_fails(void) { while (g_connections_complete == connections_complete_before) { grpc_pollset_worker worker; grpc_pollset_work(&g_pollset, &worker, gpr_now(GPR_CLOCK_MONOTONIC), - test_deadline(), &call_list); + test_deadline(), &closure_list); gpr_mu_unlock(GRPC_POLLSET_MU(&g_pollset)); - grpc_call_list_run(&call_list); + grpc_closure_list_run(&closure_list); gpr_mu_lock(GRPC_POLLSET_MU(&g_pollset)); } @@ -179,7 +180,7 @@ void test_times_out(void) { int connections_complete_before; gpr_timespec connect_deadline; grpc_closure done; - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; gpr_log(GPR_DEBUG, "test_times_out"); @@ -216,7 +217,7 @@ void test_times_out(void) { grpc_closure_init(&done, must_fail, NULL); grpc_tcp_client_connect(&done, &g_connecting, &g_pollset_set, (struct sockaddr *)&addr, addr_len, connect_deadline, - &call_list); + &closure_list); /* Make sure the event doesn't trigger early */ gpr_mu_lock(GRPC_POLLSET_MU(&g_pollset)); @@ -242,9 +243,9 @@ void test_times_out(void) { connections_complete_before + is_after_deadline); } grpc_pollset_work(&g_pollset, &worker, gpr_now(GPR_CLOCK_MONOTONIC), - GRPC_TIMEOUT_MILLIS_TO_DEADLINE(10), &call_list); + GRPC_TIMEOUT_MILLIS_TO_DEADLINE(10), &closure_list); gpr_mu_unlock(GRPC_POLLSET_MU(&g_pollset)); - grpc_call_list_run(&call_list); + grpc_closure_list_run(&closure_list); gpr_mu_lock(GRPC_POLLSET_MU(&g_pollset)); } gpr_mu_unlock(GRPC_POLLSET_MU(&g_pollset)); @@ -255,27 +256,28 @@ void test_times_out(void) { } } -static void destroy_pollset(void *p, int success, grpc_call_list *call_list) { +static void destroy_pollset(void *p, int success, + grpc_closure_list *closure_list) { grpc_pollset_destroy(p); } int main(int argc, char **argv) { grpc_closure destroyed; - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; grpc_test_init(argc, argv); grpc_init(); grpc_pollset_set_init(&g_pollset_set); grpc_pollset_init(&g_pollset); - grpc_pollset_set_add_pollset(&g_pollset_set, &g_pollset, &call_list); - grpc_call_list_run(&call_list); + grpc_pollset_set_add_pollset(&g_pollset_set, &g_pollset, &closure_list); + grpc_closure_list_run(&closure_list); test_succeeds(); gpr_log(GPR_ERROR, "End of first test"); test_fails(); test_times_out(); grpc_pollset_set_destroy(&g_pollset_set); grpc_closure_init(&destroyed, destroy_pollset, &g_pollset); - grpc_pollset_shutdown(&g_pollset, &destroyed, &call_list); - grpc_call_list_run(&call_list); + grpc_pollset_shutdown(&g_pollset, &destroyed, &closure_list); + grpc_closure_list_run(&closure_list); grpc_shutdown(); return 0; } diff --git a/test/core/iomgr/tcp_posix_test.c b/test/core/iomgr/tcp_posix_test.c index 09e67155e4..9edfe76e04 100644 --- a/test/core/iomgr/tcp_posix_test.c +++ b/test/core/iomgr/tcp_posix_test.c @@ -138,7 +138,8 @@ static size_t count_slices(gpr_slice *slices, size_t nslices, return num_bytes; } -static void read_cb(void *user_data, int success, grpc_call_list *call_list) { +static void read_cb(void *user_data, int success, + grpc_closure_list *closure_list) { struct read_socket_state *state = (struct read_socket_state *)user_data; size_t read_bytes; int current_data; @@ -155,7 +156,8 @@ static void read_cb(void *user_data, int success, grpc_call_list *call_list) { if (state->read_bytes >= state->target_read_bytes) { gpr_mu_unlock(GRPC_POLLSET_MU(&g_pollset)); } else { - grpc_endpoint_read(state->ep, &state->incoming, &state->read_cb, call_list); + grpc_endpoint_read(state->ep, &state->incoming, &state->read_cb, + closure_list); gpr_mu_unlock(GRPC_POLLSET_MU(&g_pollset)); } } @@ -167,7 +169,7 @@ static void read_test(size_t num_bytes, size_t slice_size) { struct read_socket_state state; size_t written_bytes; gpr_timespec deadline = GRPC_TIMEOUT_SECONDS_TO_DEADLINE(20); - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; gpr_log(GPR_INFO, "Read test of size %d, slice size %d", num_bytes, slice_size); @@ -175,7 +177,7 @@ static void read_test(size_t num_bytes, size_t slice_size) { create_sockets(sv); ep = grpc_tcp_create(grpc_fd_create(sv[1], "read_test"), slice_size, "test"); - grpc_endpoint_add_to_pollset(ep, &g_pollset, &call_list); + grpc_endpoint_add_to_pollset(ep, &g_pollset, &closure_list); written_bytes = fill_socket_partial(sv[0], num_bytes); gpr_log(GPR_INFO, "Wrote %d bytes", written_bytes); @@ -186,23 +188,23 @@ static void read_test(size_t num_bytes, size_t slice_size) { gpr_slice_buffer_init(&state.incoming); grpc_closure_init(&state.read_cb, read_cb, &state); - grpc_endpoint_read(ep, &state.incoming, &state.read_cb, &call_list); + grpc_endpoint_read(ep, &state.incoming, &state.read_cb, &closure_list); gpr_mu_lock(GRPC_POLLSET_MU(&g_pollset)); while (state.read_bytes < state.target_read_bytes) { grpc_pollset_worker worker; grpc_pollset_work(&g_pollset, &worker, gpr_now(GPR_CLOCK_MONOTONIC), - deadline, &call_list); + deadline, &closure_list); gpr_mu_unlock(GRPC_POLLSET_MU(&g_pollset)); - grpc_call_list_run(&call_list); + grpc_closure_list_run(&closure_list); gpr_mu_lock(GRPC_POLLSET_MU(&g_pollset)); } GPR_ASSERT(state.read_bytes == state.target_read_bytes); gpr_mu_unlock(GRPC_POLLSET_MU(&g_pollset)); gpr_slice_buffer_destroy(&state.incoming); - grpc_endpoint_destroy(ep, &call_list); - grpc_call_list_run(&call_list); + grpc_endpoint_destroy(ep, &closure_list); + grpc_closure_list_run(&closure_list); } /* Write to a socket until it fills up, then read from it using the grpc_tcp @@ -213,7 +215,7 @@ static void large_read_test(size_t slice_size) { struct read_socket_state state; ssize_t written_bytes; gpr_timespec deadline = GRPC_TIMEOUT_SECONDS_TO_DEADLINE(20); - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; gpr_log(GPR_INFO, "Start large read test, slice size %d", slice_size); @@ -221,7 +223,7 @@ static void large_read_test(size_t slice_size) { ep = grpc_tcp_create(grpc_fd_create(sv[1], "large_read_test"), slice_size, "test"); - grpc_endpoint_add_to_pollset(ep, &g_pollset, &call_list); + grpc_endpoint_add_to_pollset(ep, &g_pollset, &closure_list); written_bytes = fill_socket(sv[0]); gpr_log(GPR_INFO, "Wrote %d bytes", written_bytes); @@ -232,23 +234,23 @@ static void large_read_test(size_t slice_size) { gpr_slice_buffer_init(&state.incoming); grpc_closure_init(&state.read_cb, read_cb, &state); - grpc_endpoint_read(ep, &state.incoming, &state.read_cb, &call_list); + grpc_endpoint_read(ep, &state.incoming, &state.read_cb, &closure_list); gpr_mu_lock(GRPC_POLLSET_MU(&g_pollset)); while (state.read_bytes < state.target_read_bytes) { grpc_pollset_worker worker; grpc_pollset_work(&g_pollset, &worker, gpr_now(GPR_CLOCK_MONOTONIC), - deadline, &call_list); + deadline, &closure_list); gpr_mu_unlock(GRPC_POLLSET_MU(&g_pollset)); - grpc_call_list_run(&call_list); + grpc_closure_list_run(&closure_list); gpr_mu_lock(GRPC_POLLSET_MU(&g_pollset)); } GPR_ASSERT(state.read_bytes == state.target_read_bytes); gpr_mu_unlock(GRPC_POLLSET_MU(&g_pollset)); gpr_slice_buffer_destroy(&state.incoming); - grpc_endpoint_destroy(ep, &call_list); - grpc_call_list_run(&call_list); + grpc_endpoint_destroy(ep, &closure_list); + grpc_closure_list_run(&closure_list); } struct write_socket_state { @@ -280,7 +282,7 @@ static gpr_slice *allocate_blocks(size_t num_bytes, size_t slice_size, } static void write_done(void *user_data /* write_socket_state */, int success, - grpc_call_list *call_list) { + grpc_closure_list *closure_list) { struct write_socket_state *state = (struct write_socket_state *)user_data; gpr_log(GPR_INFO, "Write done callback called"); gpr_mu_lock(GRPC_POLLSET_MU(&g_pollset)); @@ -297,7 +299,7 @@ void drain_socket_blocking(int fd, size_t num_bytes, size_t read_size) { int flags; int current = 0; int i; - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; flags = fcntl(fd, F_GETFL, 0); GPR_ASSERT(fcntl(fd, F_SETFL, flags & ~O_NONBLOCK) == 0); @@ -306,9 +308,9 @@ void drain_socket_blocking(int fd, size_t num_bytes, size_t read_size) { grpc_pollset_worker worker; gpr_mu_lock(GRPC_POLLSET_MU(&g_pollset)); grpc_pollset_work(&g_pollset, &worker, gpr_now(GPR_CLOCK_MONOTONIC), - GRPC_TIMEOUT_MILLIS_TO_DEADLINE(10), &call_list); + GRPC_TIMEOUT_MILLIS_TO_DEADLINE(10), &closure_list); gpr_mu_unlock(GRPC_POLLSET_MU(&g_pollset)); - grpc_call_list_run(&call_list); + grpc_closure_list_run(&closure_list); do { bytes_read = read(fd, buf, bytes_left > read_size ? read_size : bytes_left); @@ -340,7 +342,7 @@ static void write_test(size_t num_bytes, size_t slice_size) { gpr_slice_buffer outgoing; grpc_closure write_done_closure; gpr_timespec deadline = GRPC_TIMEOUT_SECONDS_TO_DEADLINE(20); - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; gpr_log(GPR_INFO, "Start write test with %d bytes, slice size %d", num_bytes, slice_size); @@ -349,7 +351,7 @@ static void write_test(size_t num_bytes, size_t slice_size) { ep = grpc_tcp_create(grpc_fd_create(sv[1], "write_test"), GRPC_TCP_DEFAULT_READ_SLICE_SIZE, "test"); - grpc_endpoint_add_to_pollset(ep, &g_pollset, &call_list); + grpc_endpoint_add_to_pollset(ep, &g_pollset, &closure_list); state.ep = ep; state.write_done = 0; @@ -360,7 +362,7 @@ static void write_test(size_t num_bytes, size_t slice_size) { gpr_slice_buffer_addn(&outgoing, slices, num_blocks); grpc_closure_init(&write_done_closure, write_done, &state); - grpc_endpoint_write(ep, &outgoing, &write_done_closure, &call_list); + grpc_endpoint_write(ep, &outgoing, &write_done_closure, &closure_list); drain_socket_blocking(sv[0], num_bytes, num_bytes); gpr_mu_lock(GRPC_POLLSET_MU(&g_pollset)); for (;;) { @@ -369,17 +371,17 @@ static void write_test(size_t num_bytes, size_t slice_size) { break; } grpc_pollset_work(&g_pollset, &worker, gpr_now(GPR_CLOCK_MONOTONIC), - deadline, &call_list); + deadline, &closure_list); gpr_mu_unlock(GRPC_POLLSET_MU(&g_pollset)); - grpc_call_list_run(&call_list); + grpc_closure_list_run(&closure_list); gpr_mu_lock(GRPC_POLLSET_MU(&g_pollset)); } gpr_mu_unlock(GRPC_POLLSET_MU(&g_pollset)); gpr_slice_buffer_destroy(&outgoing); - grpc_endpoint_destroy(ep, &call_list); + grpc_endpoint_destroy(ep, &closure_list); gpr_free(slices); - grpc_call_list_run(&call_list); + grpc_closure_list_run(&closure_list); } void run_tests(void) { @@ -409,17 +411,17 @@ static grpc_endpoint_test_fixture create_fixture_tcp_socketpair( size_t slice_size) { int sv[2]; grpc_endpoint_test_fixture f; - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; create_sockets(sv); f.client_ep = grpc_tcp_create(grpc_fd_create(sv[0], "fixture:client"), slice_size, "test"); f.server_ep = grpc_tcp_create(grpc_fd_create(sv[1], "fixture:server"), slice_size, "test"); - grpc_endpoint_add_to_pollset(f.client_ep, &g_pollset, &call_list); - grpc_endpoint_add_to_pollset(f.server_ep, &g_pollset, &call_list); + grpc_endpoint_add_to_pollset(f.client_ep, &g_pollset, &closure_list); + grpc_endpoint_add_to_pollset(f.server_ep, &g_pollset, &closure_list); - grpc_call_list_run(&call_list); + grpc_closure_list_run(&closure_list); return f; } @@ -428,21 +430,22 @@ static grpc_endpoint_test_config configs[] = { {"tcp/tcp_socketpair", create_fixture_tcp_socketpair, clean_up}, }; -static void destroy_pollset(void *p, int success, grpc_call_list *call_list) { +static void destroy_pollset(void *p, int success, + grpc_closure_list *closure_list) { grpc_pollset_destroy(p); } int main(int argc, char **argv) { grpc_closure destroyed; - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; grpc_test_init(argc, argv); grpc_init(); grpc_pollset_init(&g_pollset); run_tests(); grpc_endpoint_tests(configs[0], &g_pollset); grpc_closure_init(&destroyed, destroy_pollset, &g_pollset); - grpc_pollset_shutdown(&g_pollset, &destroyed, &call_list); - grpc_call_list_run(&call_list); + grpc_pollset_shutdown(&g_pollset, &destroyed, &closure_list); + grpc_closure_list_run(&closure_list); grpc_shutdown(); return 0; diff --git a/test/core/iomgr/tcp_server_posix_test.c b/test/core/iomgr/tcp_server_posix_test.c index 6ce78d2088..4a3b51efc6 100644 --- a/test/core/iomgr/tcp_server_posix_test.c +++ b/test/core/iomgr/tcp_server_posix_test.c @@ -49,9 +49,9 @@ static grpc_pollset g_pollset; static int g_nconnects = 0; static void on_connect(void *arg, grpc_endpoint *tcp, - grpc_call_list *call_list) { - grpc_endpoint_shutdown(tcp, call_list); - grpc_endpoint_destroy(tcp, call_list); + grpc_closure_list *closure_list) { + grpc_endpoint_shutdown(tcp, closure_list); + grpc_endpoint_destroy(tcp, closure_list); gpr_mu_lock(GRPC_POLLSET_MU(&g_pollset)); g_nconnects++; @@ -65,16 +65,16 @@ static void test_no_op(void) { } static void test_no_op_with_start(void) { - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; grpc_tcp_server *s = grpc_tcp_server_create(); LOG_TEST("test_no_op_with_start"); - grpc_tcp_server_start(s, NULL, 0, on_connect, NULL, &call_list); + grpc_tcp_server_start(s, NULL, 0, on_connect, NULL, &closure_list); grpc_tcp_server_destroy(s, NULL, NULL); - grpc_call_list_run(&call_list); + grpc_closure_list_run(&closure_list); } static void test_no_op_with_port(void) { - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; struct sockaddr_in addr; grpc_tcp_server *s = grpc_tcp_server_create(); LOG_TEST("test_no_op_with_port"); @@ -84,12 +84,12 @@ static void test_no_op_with_port(void) { GPR_ASSERT( grpc_tcp_server_add_port(s, (struct sockaddr *)&addr, sizeof(addr))); - grpc_tcp_server_destroy(s, NULL, &call_list); - grpc_call_list_run(&call_list); + grpc_tcp_server_destroy(s, NULL, &closure_list); + grpc_closure_list_run(&closure_list); } static void test_no_op_with_port_and_start(void) { - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; struct sockaddr_in addr; grpc_tcp_server *s = grpc_tcp_server_create(); LOG_TEST("test_no_op_with_port_and_start"); @@ -99,14 +99,14 @@ static void test_no_op_with_port_and_start(void) { GPR_ASSERT( grpc_tcp_server_add_port(s, (struct sockaddr *)&addr, sizeof(addr))); - grpc_tcp_server_start(s, NULL, 0, on_connect, NULL, &call_list); + grpc_tcp_server_start(s, NULL, 0, on_connect, NULL, &closure_list); - grpc_tcp_server_destroy(s, NULL, &call_list); - grpc_call_list_run(&call_list); + grpc_tcp_server_destroy(s, NULL, &closure_list); + grpc_closure_list_run(&closure_list); } static void test_connect(int n) { - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; struct sockaddr_storage addr; socklen_t addr_len = sizeof(addr); int svrfd, clifd; @@ -128,7 +128,7 @@ static void test_connect(int n) { GPR_ASSERT(addr_len <= sizeof(addr)); pollsets[0] = &g_pollset; - grpc_tcp_server_start(s, pollsets, 1, on_connect, NULL, &call_list); + grpc_tcp_server_start(s, pollsets, 1, on_connect, NULL, &closure_list); gpr_mu_lock(GRPC_POLLSET_MU(&g_pollset)); @@ -146,9 +146,9 @@ static void test_connect(int n) { gpr_time_cmp(deadline, gpr_now(deadline.clock_type)) > 0) { grpc_pollset_worker worker; grpc_pollset_work(&g_pollset, &worker, gpr_now(GPR_CLOCK_MONOTONIC), - deadline, &call_list); + deadline, &closure_list); gpr_mu_unlock(GRPC_POLLSET_MU(&g_pollset)); - grpc_call_list_run(&call_list); + grpc_closure_list_run(&closure_list); gpr_mu_lock(GRPC_POLLSET_MU(&g_pollset)); } gpr_log(GPR_DEBUG, "wait done"); @@ -159,17 +159,18 @@ static void test_connect(int n) { gpr_mu_unlock(GRPC_POLLSET_MU(&g_pollset)); - grpc_tcp_server_destroy(s, NULL, &call_list); - grpc_call_list_run(&call_list); + grpc_tcp_server_destroy(s, NULL, &closure_list); + grpc_closure_list_run(&closure_list); } -static void destroy_pollset(void *p, int success, grpc_call_list *call_list) { +static void destroy_pollset(void *p, int success, + grpc_closure_list *closure_list) { grpc_pollset_destroy(p); } int main(int argc, char **argv) { grpc_closure destroyed; - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; grpc_test_init(argc, argv); grpc_iomgr_init(); grpc_pollset_init(&g_pollset); @@ -182,8 +183,8 @@ int main(int argc, char **argv) { test_connect(10); grpc_closure_init(&destroyed, destroy_pollset, &g_pollset); - grpc_pollset_shutdown(&g_pollset, &destroyed, &call_list); - grpc_call_list_run(&call_list); + grpc_pollset_shutdown(&g_pollset, &destroyed, &closure_list); + grpc_closure_list_run(&closure_list); grpc_iomgr_shutdown(); return 0; } diff --git a/test/core/iomgr/udp_server_test.c b/test/core/iomgr/udp_server_test.c index 86b6b9a9fa..067838777a 100644 --- a/test/core/iomgr/udp_server_test.c +++ b/test/core/iomgr/udp_server_test.c @@ -69,12 +69,12 @@ static void test_no_op(void) { } static void test_no_op_with_start(void) { - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; grpc_udp_server *s = grpc_udp_server_create(); LOG_TEST("test_no_op_with_start"); - grpc_udp_server_start(s, NULL, 0, &call_list); + grpc_udp_server_start(s, NULL, 0, &closure_list); grpc_udp_server_destroy(s, NULL, NULL); - grpc_call_list_run(&call_list); + grpc_closure_list_run(&closure_list); } static void test_no_op_with_port(void) { @@ -91,7 +91,7 @@ static void test_no_op_with_port(void) { } static void test_no_op_with_port_and_start(void) { - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; struct sockaddr_in addr; grpc_udp_server *s = grpc_udp_server_create(); LOG_TEST("test_no_op_with_port_and_start"); @@ -101,14 +101,14 @@ static void test_no_op_with_port_and_start(void) { GPR_ASSERT(grpc_udp_server_add_port(s, (struct sockaddr *)&addr, sizeof(addr), on_read)); - grpc_udp_server_start(s, NULL, 0, &call_list); + grpc_udp_server_start(s, NULL, 0, &closure_list); - grpc_udp_server_destroy(s, NULL, &call_list); - grpc_call_list_run(&call_list); + grpc_udp_server_destroy(s, NULL, &closure_list); + grpc_closure_list_run(&closure_list); } static void test_receive(int number_of_clients) { - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; struct sockaddr_storage addr; socklen_t addr_len = sizeof(addr); int clifd, svrfd; @@ -133,7 +133,7 @@ static void test_receive(int number_of_clients) { GPR_ASSERT(addr_len <= sizeof(addr)); pollsets[0] = &g_pollset; - grpc_udp_server_start(s, pollsets, 1, &call_list); + grpc_udp_server_start(s, pollsets, 1, &closure_list); gpr_mu_lock(GRPC_POLLSET_MU(&g_pollset)); @@ -150,9 +150,9 @@ static void test_receive(int number_of_clients) { gpr_time_cmp(deadline, gpr_now(deadline.clock_type)) > 0) { grpc_pollset_worker worker; grpc_pollset_work(&g_pollset, &worker, gpr_now(GPR_CLOCK_MONOTONIC), - deadline, &call_list); + deadline, &closure_list); gpr_mu_unlock(GRPC_POLLSET_MU(&g_pollset)); - grpc_call_list_run(&call_list); + grpc_closure_list_run(&closure_list); gpr_mu_lock(GRPC_POLLSET_MU(&g_pollset)); } GPR_ASSERT(g_number_of_reads == number_of_reads_before + 1); @@ -165,13 +165,14 @@ static void test_receive(int number_of_clients) { grpc_udp_server_destroy(s, NULL, NULL); } -static void destroy_pollset(void *p, int success, grpc_call_list *call_list) { +static void destroy_pollset(void *p, int success, + grpc_closure_list *closure_list) { grpc_pollset_destroy(p); } int main(int argc, char **argv) { grpc_closure destroyed; - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; grpc_test_init(argc, argv); grpc_iomgr_init(); grpc_pollset_init(&g_pollset); @@ -184,8 +185,8 @@ int main(int argc, char **argv) { test_receive(10); grpc_closure_init(&destroyed, destroy_pollset, &g_pollset); - grpc_pollset_shutdown(&g_pollset, &destroyed, &call_list); - grpc_call_list_run(&call_list); + grpc_pollset_shutdown(&g_pollset, &destroyed, &closure_list); + grpc_closure_list_run(&closure_list); grpc_iomgr_shutdown(); return 0; } diff --git a/test/core/iomgr/workqueue_test.c b/test/core/iomgr/workqueue_test.c index 08030dfe83..e4f172d32e 100644 --- a/test/core/iomgr/workqueue_test.c +++ b/test/core/iomgr/workqueue_test.c @@ -40,7 +40,8 @@ static grpc_pollset g_pollset; -static void must_succeed(void *p, int success, grpc_call_list *call_list) { +static void must_succeed(void *p, int success, + grpc_closure_list *closure_list) { GPR_ASSERT(success == 1); gpr_mu_lock(GRPC_POLLSET_MU(&g_pollset)); *(int *)p = 1; @@ -51,34 +52,35 @@ static void must_succeed(void *p, int success, grpc_call_list *call_list) { static void test_add_closure(void) { grpc_closure c; int done = 0; - grpc_call_list call_list = GRPC_CALL_LIST_INIT; - grpc_workqueue *wq = grpc_workqueue_create(&call_list); + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; + grpc_workqueue *wq = grpc_workqueue_create(&closure_list); gpr_timespec deadline = GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5); grpc_pollset_worker worker; grpc_closure_init(&c, must_succeed, &done); grpc_workqueue_push(wq, &c, 1); - grpc_workqueue_add_to_pollset(wq, &g_pollset, &call_list); + grpc_workqueue_add_to_pollset(wq, &g_pollset, &closure_list); gpr_mu_lock(GRPC_POLLSET_MU(&g_pollset)); GPR_ASSERT(!done); grpc_pollset_work(&g_pollset, &worker, gpr_now(deadline.clock_type), deadline, - &call_list); + &closure_list); gpr_mu_unlock(GRPC_POLLSET_MU(&g_pollset)); - grpc_call_list_run(&call_list); + grpc_closure_list_run(&closure_list); GPR_ASSERT(done); - GRPC_WORKQUEUE_UNREF(wq, "destroy", &call_list); - grpc_call_list_run(&call_list); + GRPC_WORKQUEUE_UNREF(wq, "destroy", &closure_list); + grpc_closure_list_run(&closure_list); } -static void destroy_pollset(void *p, int success, grpc_call_list *call_list) { +static void destroy_pollset(void *p, int success, + grpc_closure_list *closure_list) { grpc_pollset_destroy(p); } int main(int argc, char **argv) { grpc_closure destroyed; - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; grpc_test_init(argc, argv); grpc_init(); grpc_pollset_init(&g_pollset); @@ -86,8 +88,8 @@ int main(int argc, char **argv) { test_add_closure(); grpc_closure_init(&destroyed, destroy_pollset, &g_pollset); - grpc_pollset_shutdown(&g_pollset, &destroyed, &call_list); - grpc_call_list_run(&call_list); + grpc_pollset_shutdown(&g_pollset, &destroyed, &closure_list); + grpc_closure_list_run(&closure_list); grpc_shutdown(); return 0; } diff --git a/test/core/security/credentials_test.c b/test/core/security/credentials_test.c index c7bd7ab4f4..e48aab95fa 100644 --- a/test/core/security/credentials_test.c +++ b/test/core/security/credentials_test.c @@ -319,7 +319,7 @@ static void check_google_iam_metadata(void *user_data, grpc_credentials_md *md_elems, size_t num_md, grpc_credentials_status status, - grpc_call_list *call_list) { + grpc_closure_list *closure_list) { grpc_credentials *c = (grpc_credentials *)user_data; expected_md emd[] = {{GRPC_IAM_AUTHORIZATION_TOKEN_METADATA_KEY, test_google_iam_authorization_token}, @@ -332,7 +332,7 @@ static void check_google_iam_metadata(void *user_data, } static void test_google_iam_creds(void) { - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; grpc_credentials *creds = grpc_google_iam_credentials_create( test_google_iam_authorization_token, test_google_iam_authority_selector, NULL); @@ -340,15 +340,15 @@ static void test_google_iam_creds(void) { GPR_ASSERT(grpc_credentials_has_request_metadata_only(creds)); grpc_credentials_get_request_metadata(creds, NULL, test_service_url, check_google_iam_metadata, creds, - &call_list); - grpc_call_list_run(&call_list); + &closure_list); + grpc_closure_list_run(&closure_list); } static void check_access_token_metadata(void *user_data, grpc_credentials_md *md_elems, size_t num_md, grpc_credentials_status status, - grpc_call_list *call_list) { + grpc_closure_list *closure_list) { grpc_credentials *c = (grpc_credentials *)user_data; expected_md emd[] = {{GRPC_AUTHORIZATION_METADATA_KEY, "Bearer blah"}}; GPR_ASSERT(status == GRPC_CREDENTIALS_OK); @@ -358,22 +358,20 @@ static void check_access_token_metadata(void *user_data, } static void test_access_token_creds(void) { - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; grpc_credentials *creds = grpc_access_token_credentials_create("blah", NULL); GPR_ASSERT(grpc_credentials_has_request_metadata(creds)); GPR_ASSERT(grpc_credentials_has_request_metadata_only(creds)); GPR_ASSERT(strcmp(creds->type, GRPC_CREDENTIALS_TYPE_OAUTH2) == 0); grpc_credentials_get_request_metadata(creds, NULL, test_service_url, check_access_token_metadata, creds, - &call_list); - grpc_call_list_run(&call_list); + &closure_list); + grpc_closure_list_run(&closure_list); } -static void check_ssl_oauth2_composite_metadata(void *user_data, - grpc_credentials_md *md_elems, - size_t num_md, - grpc_credentials_status status, - grpc_call_list *call_list) { +static void check_ssl_oauth2_composite_metadata( + void *user_data, grpc_credentials_md *md_elems, size_t num_md, + grpc_credentials_status status, grpc_closure_list *closure_list) { grpc_credentials *c = (grpc_credentials *)user_data; expected_md emd[] = { {GRPC_AUTHORIZATION_METADATA_KEY, test_oauth2_bearer_token}}; @@ -384,7 +382,7 @@ static void check_ssl_oauth2_composite_metadata(void *user_data, } static void test_ssl_oauth2_composite_creds(void) { - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; grpc_credentials *ssl_creds = grpc_ssl_credentials_create(test_root_cert, NULL, NULL); const grpc_credentials_array *creds_array; @@ -406,8 +404,8 @@ static void test_ssl_oauth2_composite_creds(void) { GRPC_CREDENTIALS_TYPE_OAUTH2) == 0); grpc_credentials_get_request_metadata(composite_creds, NULL, test_service_url, check_ssl_oauth2_composite_metadata, - composite_creds, &call_list); - grpc_call_list_run(&call_list); + composite_creds, &closure_list); + grpc_closure_list_run(&closure_list); } void test_ssl_fake_transport_security_composite_creds_failure(void) { @@ -424,7 +422,7 @@ void test_ssl_fake_transport_security_composite_creds_failure(void) { static void check_ssl_oauth2_google_iam_composite_metadata( void *user_data, grpc_credentials_md *md_elems, size_t num_md, - grpc_credentials_status status, grpc_call_list *call_list) { + grpc_credentials_status status, grpc_closure_list *closure_list) { grpc_credentials *c = (grpc_credentials *)user_data; expected_md emd[] = { {GRPC_AUTHORIZATION_METADATA_KEY, test_oauth2_bearer_token}, @@ -439,7 +437,7 @@ static void check_ssl_oauth2_google_iam_composite_metadata( } static void test_ssl_oauth2_google_iam_composite_creds(void) { - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; grpc_credentials *ssl_creds = grpc_ssl_credentials_create(test_root_cert, NULL, NULL); const grpc_credentials_array *creds_array; @@ -471,15 +469,13 @@ static void test_ssl_oauth2_google_iam_composite_creds(void) { grpc_credentials_get_request_metadata( composite_creds, NULL, test_service_url, check_ssl_oauth2_google_iam_composite_metadata, composite_creds, - &call_list); - grpc_call_list_run(&call_list); + &closure_list); + grpc_closure_list_run(&closure_list); } -static void on_oauth2_creds_get_metadata_success(void *user_data, - grpc_credentials_md *md_elems, - size_t num_md, - grpc_credentials_status status, - grpc_call_list *call_list) { +static void on_oauth2_creds_get_metadata_success( + void *user_data, grpc_credentials_md *md_elems, size_t num_md, + grpc_credentials_status status, grpc_closure_list *closure_list) { GPR_ASSERT(status == GRPC_CREDENTIALS_OK); GPR_ASSERT(num_md == 1); GPR_ASSERT(gpr_slice_str_cmp(md_elems[0].key, "Authorization") == 0); @@ -490,11 +486,9 @@ static void on_oauth2_creds_get_metadata_success(void *user_data, GPR_ASSERT(strcmp((const char *)user_data, test_user_data) == 0); } -static void on_oauth2_creds_get_metadata_failure(void *user_data, - grpc_credentials_md *md_elems, - size_t num_md, - grpc_credentials_status status, - grpc_call_list *call_list) { +static void on_oauth2_creds_get_metadata_failure( + void *user_data, grpc_credentials_md *md_elems, size_t num_md, + grpc_credentials_status status, grpc_closure_list *closure_list) { GPR_ASSERT(status == GRPC_CREDENTIALS_ERROR); GPR_ASSERT(num_md == 0); GPR_ASSERT(user_data != NULL); @@ -517,21 +511,21 @@ static void validate_compute_engine_http_request( static int compute_engine_httpcli_get_success_override( const grpc_httpcli_request *request, gpr_timespec deadline, grpc_httpcli_response_cb on_response, void *user_data, - grpc_call_list *call_list) { + grpc_closure_list *closure_list) { grpc_httpcli_response response = http_response(200, valid_oauth2_json_response); validate_compute_engine_http_request(request); - on_response(user_data, &response, call_list); + on_response(user_data, &response, closure_list); return 1; } static int compute_engine_httpcli_get_failure_override( const grpc_httpcli_request *request, gpr_timespec deadline, grpc_httpcli_response_cb on_response, void *user_data, - grpc_call_list *call_list) { + grpc_closure_list *closure_list) { grpc_httpcli_response response = http_response(403, "Not Authorized."); validate_compute_engine_http_request(request); - on_response(user_data, &response, call_list); + on_response(user_data, &response, closure_list); return 1; } @@ -539,7 +533,7 @@ static int httpcli_post_should_not_be_called( const grpc_httpcli_request *request, const char *body_bytes, size_t body_size, gpr_timespec deadline, grpc_httpcli_response_cb on_response, void *user_data, - grpc_call_list *call_list) { + grpc_closure_list *closure_list) { GPR_ASSERT("HTTP POST should not be called" == NULL); return 1; } @@ -547,13 +541,13 @@ static int httpcli_post_should_not_be_called( static int httpcli_get_should_not_be_called( const grpc_httpcli_request *request, gpr_timespec deadline, grpc_httpcli_response_cb on_response, void *user_data, - grpc_call_list *call_list) { + grpc_closure_list *closure_list) { GPR_ASSERT("HTTP GET should not be called" == NULL); return 1; } static void test_compute_engine_creds_success(void) { - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; grpc_credentials *compute_engine_creds = grpc_google_compute_engine_credentials_create(NULL); GPR_ASSERT(grpc_credentials_has_request_metadata(compute_engine_creds)); @@ -562,37 +556,40 @@ static void test_compute_engine_creds_success(void) { /* First request: http get should be called. */ grpc_httpcli_set_override(compute_engine_httpcli_get_success_override, httpcli_post_should_not_be_called); - grpc_credentials_get_request_metadata( - compute_engine_creds, NULL, test_service_url, - on_oauth2_creds_get_metadata_success, (void *)test_user_data, &call_list); - grpc_call_list_run(&call_list); + grpc_credentials_get_request_metadata(compute_engine_creds, NULL, + test_service_url, + on_oauth2_creds_get_metadata_success, + (void *)test_user_data, &closure_list); + grpc_closure_list_run(&closure_list); /* Second request: the cached token should be served directly. */ grpc_httpcli_set_override(httpcli_get_should_not_be_called, httpcli_post_should_not_be_called); - grpc_credentials_get_request_metadata( - compute_engine_creds, NULL, test_service_url, - on_oauth2_creds_get_metadata_success, (void *)test_user_data, &call_list); - grpc_call_list_run(&call_list); + grpc_credentials_get_request_metadata(compute_engine_creds, NULL, + test_service_url, + on_oauth2_creds_get_metadata_success, + (void *)test_user_data, &closure_list); + grpc_closure_list_run(&closure_list); grpc_credentials_unref(compute_engine_creds); grpc_httpcli_set_override(NULL, NULL); } static void test_compute_engine_creds_failure(void) { - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; grpc_credentials *compute_engine_creds = grpc_google_compute_engine_credentials_create(NULL); grpc_httpcli_set_override(compute_engine_httpcli_get_failure_override, httpcli_post_should_not_be_called); GPR_ASSERT(grpc_credentials_has_request_metadata(compute_engine_creds)); GPR_ASSERT(grpc_credentials_has_request_metadata_only(compute_engine_creds)); - grpc_credentials_get_request_metadata( - compute_engine_creds, NULL, test_service_url, - on_oauth2_creds_get_metadata_failure, (void *)test_user_data, &call_list); + grpc_credentials_get_request_metadata(compute_engine_creds, NULL, + test_service_url, + on_oauth2_creds_get_metadata_failure, + (void *)test_user_data, &closure_list); grpc_credentials_unref(compute_engine_creds); grpc_httpcli_set_override(NULL, NULL); - grpc_call_list_run(&call_list); + grpc_closure_list_run(&closure_list); } static void validate_refresh_token_http_request( @@ -620,26 +617,26 @@ static void validate_refresh_token_http_request( static int refresh_token_httpcli_post_success( const grpc_httpcli_request *request, const char *body, size_t body_size, gpr_timespec deadline, grpc_httpcli_response_cb on_response, - void *user_data, grpc_call_list *call_list) { + void *user_data, grpc_closure_list *closure_list) { grpc_httpcli_response response = http_response(200, valid_oauth2_json_response); validate_refresh_token_http_request(request, body, body_size); - on_response(user_data, &response, call_list); + on_response(user_data, &response, closure_list); return 1; } static int refresh_token_httpcli_post_failure( const grpc_httpcli_request *request, const char *body, size_t body_size, gpr_timespec deadline, grpc_httpcli_response_cb on_response, - void *user_data, grpc_call_list *call_list) { + void *user_data, grpc_closure_list *closure_list) { grpc_httpcli_response response = http_response(403, "Not Authorized."); validate_refresh_token_http_request(request, body, body_size); - on_response(user_data, &response, call_list); + on_response(user_data, &response, closure_list); return 1; } static void test_refresh_token_creds_success(void) { - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; grpc_credentials *refresh_token_creds = grpc_google_refresh_token_credentials_create(test_refresh_token_str, NULL); @@ -649,26 +646,28 @@ static void test_refresh_token_creds_success(void) { /* First request: http get should be called. */ grpc_httpcli_set_override(httpcli_get_should_not_be_called, refresh_token_httpcli_post_success); - grpc_credentials_get_request_metadata( - refresh_token_creds, NULL, test_service_url, - on_oauth2_creds_get_metadata_success, (void *)test_user_data, &call_list); - grpc_call_list_run(&call_list); + grpc_credentials_get_request_metadata(refresh_token_creds, NULL, + test_service_url, + on_oauth2_creds_get_metadata_success, + (void *)test_user_data, &closure_list); + grpc_closure_list_run(&closure_list); /* Second request: the cached token should be served directly. */ grpc_httpcli_set_override(httpcli_get_should_not_be_called, httpcli_post_should_not_be_called); - grpc_credentials_get_request_metadata( - refresh_token_creds, NULL, test_service_url, - on_oauth2_creds_get_metadata_success, (void *)test_user_data, &call_list); - grpc_call_list_run(&call_list); + grpc_credentials_get_request_metadata(refresh_token_creds, NULL, + test_service_url, + on_oauth2_creds_get_metadata_success, + (void *)test_user_data, &closure_list); + grpc_closure_list_run(&closure_list); grpc_credentials_unref(refresh_token_creds); grpc_httpcli_set_override(NULL, NULL); - grpc_call_list_run(&call_list); + grpc_closure_list_run(&closure_list); } static void test_refresh_token_creds_failure(void) { - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; grpc_credentials *refresh_token_creds = grpc_google_refresh_token_credentials_create(test_refresh_token_str, NULL); @@ -676,12 +675,13 @@ static void test_refresh_token_creds_failure(void) { refresh_token_httpcli_post_failure); GPR_ASSERT(grpc_credentials_has_request_metadata(refresh_token_creds)); GPR_ASSERT(grpc_credentials_has_request_metadata_only(refresh_token_creds)); - grpc_credentials_get_request_metadata( - refresh_token_creds, NULL, test_service_url, - on_oauth2_creds_get_metadata_failure, (void *)test_user_data, &call_list); + grpc_credentials_get_request_metadata(refresh_token_creds, NULL, + test_service_url, + on_oauth2_creds_get_metadata_failure, + (void *)test_user_data, &closure_list); grpc_credentials_unref(refresh_token_creds); grpc_httpcli_set_override(NULL, NULL); - grpc_call_list_run(&call_list); + grpc_closure_list_run(&closure_list); } static void validate_jwt_encode_and_sign_params( @@ -733,7 +733,7 @@ static void on_jwt_creds_get_metadata_success(void *user_data, grpc_credentials_md *md_elems, size_t num_md, grpc_credentials_status status, - grpc_call_list *call_list) { + grpc_closure_list *closure_list) { char *expected_md_value; gpr_asprintf(&expected_md_value, "Bearer %s", test_signed_jwt); GPR_ASSERT(status == GRPC_CREDENTIALS_OK); @@ -749,7 +749,7 @@ static void on_jwt_creds_get_metadata_failure(void *user_data, grpc_credentials_md *md_elems, size_t num_md, grpc_credentials_status status, - grpc_call_list *call_list) { + grpc_closure_list *closure_list) { GPR_ASSERT(status == GRPC_CREDENTIALS_ERROR); GPR_ASSERT(num_md == 0); GPR_ASSERT(user_data != NULL); @@ -758,7 +758,7 @@ static void on_jwt_creds_get_metadata_failure(void *user_data, static void test_jwt_creds_success(void) { char *json_key_string = test_json_key_str(); - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; grpc_credentials *jwt_creds = grpc_service_account_jwt_access_credentials_create( json_key_string, grpc_max_auth_token_lifetime, NULL); @@ -769,24 +769,24 @@ static void test_jwt_creds_success(void) { grpc_jwt_encode_and_sign_set_override(encode_and_sign_jwt_success); grpc_credentials_get_request_metadata(jwt_creds, NULL, test_service_url, on_jwt_creds_get_metadata_success, - (void *)test_user_data, &call_list); - grpc_call_list_run(&call_list); + (void *)test_user_data, &closure_list); + grpc_closure_list_run(&closure_list); /* Second request: the cached token should be served directly. */ grpc_jwt_encode_and_sign_set_override( encode_and_sign_jwt_should_not_be_called); grpc_credentials_get_request_metadata(jwt_creds, NULL, test_service_url, on_jwt_creds_get_metadata_success, - (void *)test_user_data, &call_list); - grpc_call_list_run(&call_list); + (void *)test_user_data, &closure_list); + grpc_closure_list_run(&closure_list); /* Third request: Different service url so jwt_encode_and_sign should be called again (no caching). */ grpc_jwt_encode_and_sign_set_override(encode_and_sign_jwt_success); grpc_credentials_get_request_metadata(jwt_creds, NULL, other_test_service_url, on_jwt_creds_get_metadata_success, - (void *)test_user_data, &call_list); - grpc_call_list_run(&call_list); + (void *)test_user_data, &closure_list); + grpc_closure_list_run(&closure_list); gpr_free(json_key_string); grpc_credentials_unref(jwt_creds); @@ -795,7 +795,7 @@ static void test_jwt_creds_success(void) { static void test_jwt_creds_signing_failure(void) { char *json_key_string = test_json_key_str(); - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; grpc_credentials *jwt_creds = grpc_service_account_jwt_access_credentials_create( json_key_string, grpc_max_auth_token_lifetime, NULL); @@ -805,12 +805,12 @@ static void test_jwt_creds_signing_failure(void) { grpc_jwt_encode_and_sign_set_override(encode_and_sign_jwt_failure); grpc_credentials_get_request_metadata(jwt_creds, NULL, test_service_url, on_jwt_creds_get_metadata_failure, - (void *)test_user_data, &call_list); + (void *)test_user_data, &closure_list); gpr_free(json_key_string); grpc_credentials_unref(jwt_creds); grpc_jwt_encode_and_sign_set_override(NULL); - grpc_call_list_run(&call_list); + grpc_closure_list_run(&closure_list); } static void set_google_default_creds_env_var_with_file_contents( @@ -915,11 +915,9 @@ static void plugin_get_metadata_failure(void *state, const char *service_url, "Could not get metadata for plugin."); } -static void on_plugin_metadata_received_success(void *user_data, - grpc_credentials_md *md_elems, - size_t num_md, - grpc_credentials_status status, - grpc_call_list *call_list) { +static void on_plugin_metadata_received_success( + void *user_data, grpc_credentials_md *md_elems, size_t num_md, + grpc_credentials_status status, grpc_closure_list *closure_list) { size_t i = 0; GPR_ASSERT(user_data == NULL); GPR_ASSERT(md_elems != NULL); @@ -930,11 +928,9 @@ static void on_plugin_metadata_received_success(void *user_data, } } -static void on_plugin_metadata_received_failure(void *user_data, - grpc_credentials_md *md_elems, - size_t num_md, - grpc_credentials_status status, - grpc_call_list *call_list) { +static void on_plugin_metadata_received_failure( + void *user_data, grpc_credentials_md *md_elems, size_t num_md, + grpc_credentials_status status, grpc_closure_list *closure_list) { GPR_ASSERT(user_data == NULL); GPR_ASSERT(md_elems == NULL); GPR_ASSERT(num_md == 0); @@ -950,7 +946,7 @@ static void test_metadata_plugin_success(void) { grpc_credentials *creds; plugin_state state = PLUGIN_INITIAL_STATE; grpc_metadata_credentials_plugin plugin; - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; plugin.state = &state; plugin.get_metadata = plugin_get_metadata_success; @@ -960,18 +956,18 @@ static void test_metadata_plugin_success(void) { GPR_ASSERT(state == PLUGIN_INITIAL_STATE); grpc_credentials_get_request_metadata(creds, NULL, test_service_url, on_plugin_metadata_received_success, - NULL, &call_list); + NULL, &closure_list); GPR_ASSERT(state == PLUGIN_GET_METADATA_CALLED_STATE); grpc_credentials_release(creds); GPR_ASSERT(state == PLUGIN_DESTROY_CALLED_STATE); - grpc_call_list_run(&call_list); + grpc_closure_list_run(&closure_list); } static void test_metadata_plugin_failure(void) { grpc_credentials *creds; plugin_state state = PLUGIN_INITIAL_STATE; grpc_metadata_credentials_plugin plugin; - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; plugin.state = &state; plugin.get_metadata = plugin_get_metadata_failure; @@ -981,11 +977,11 @@ static void test_metadata_plugin_failure(void) { GPR_ASSERT(state == PLUGIN_INITIAL_STATE); grpc_credentials_get_request_metadata(creds, NULL, test_service_url, on_plugin_metadata_received_failure, - NULL, &call_list); + NULL, &closure_list); GPR_ASSERT(state == PLUGIN_GET_METADATA_CALLED_STATE); grpc_credentials_release(creds); GPR_ASSERT(state == PLUGIN_DESTROY_CALLED_STATE); - grpc_call_list_run(&call_list); + grpc_closure_list_run(&closure_list); } int main(int argc, char **argv) { diff --git a/test/core/security/jwt_verifier_test.c b/test/core/security/jwt_verifier_test.c index 00a079f54e..f2215e1822 100644 --- a/test/core/security/jwt_verifier_test.c +++ b/test/core/security/jwt_verifier_test.c @@ -277,7 +277,7 @@ static int httpcli_post_should_not_be_called( const grpc_httpcli_request *request, const char *body_bytes, size_t body_size, gpr_timespec deadline, grpc_httpcli_response_cb on_response, void *user_data, - grpc_call_list *call_list) { + grpc_closure_list *closure_list) { GPR_ASSERT("HTTP POST should not be called" == NULL); return 1; } @@ -285,7 +285,7 @@ static int httpcli_post_should_not_be_called( static int httpcli_get_google_keys_for_email( const grpc_httpcli_request *request, gpr_timespec deadline, grpc_httpcli_response_cb on_response, void *user_data, - grpc_call_list *call_list) { + grpc_closure_list *closure_list) { grpc_httpcli_response response = http_response(200, good_google_email_keys()); GPR_ASSERT(request->handshaker == &grpc_httpcli_ssl); GPR_ASSERT(strcmp(request->host, "www.googleapis.com") == 0); @@ -293,7 +293,7 @@ static int httpcli_get_google_keys_for_email( "/robot/v1/metadata/x509/" "777-abaslkan11hlb6nmim3bpspl31ud@developer." "gserviceaccount.com") == 0); - on_response(user_data, &response, call_list); + on_response(user_data, &response, closure_list); gpr_free(response.body); return 1; } @@ -309,7 +309,7 @@ static void on_verification_success(void *user_data, } static void test_jwt_verifier_google_email_issuer_success(void) { - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; grpc_jwt_verifier *verifier = grpc_jwt_verifier_create(NULL, 0); char *jwt = NULL; char *key_str = json_key_str(json_key_str_part3_for_google_email_issuer); @@ -324,28 +324,28 @@ static void test_jwt_verifier_google_email_issuer_success(void) { GPR_ASSERT(jwt != NULL); grpc_jwt_verifier_verify(verifier, NULL, jwt, expected_audience, on_verification_success, (void *)expected_user_data, - &call_list); + &closure_list); gpr_free(jwt); grpc_jwt_verifier_destroy(verifier); grpc_httpcli_set_override(NULL, NULL); - grpc_call_list_run(&call_list); + grpc_closure_list_run(&closure_list); } static int httpcli_get_custom_keys_for_email( const grpc_httpcli_request *request, gpr_timespec deadline, grpc_httpcli_response_cb on_response, void *user_data, - grpc_call_list *call_list) { + grpc_closure_list *closure_list) { grpc_httpcli_response response = http_response(200, gpr_strdup(good_jwk_set)); GPR_ASSERT(request->handshaker == &grpc_httpcli_ssl); GPR_ASSERT(strcmp(request->host, "keys.bar.com") == 0); GPR_ASSERT(strcmp(request->path, "/jwk/foo@bar.com") == 0); - on_response(user_data, &response, call_list); + on_response(user_data, &response, closure_list); gpr_free(response.body); return 1; } static void test_jwt_verifier_custom_email_issuer_success(void) { - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; grpc_jwt_verifier *verifier = grpc_jwt_verifier_create(&custom_mapping, 1); char *jwt = NULL; char *key_str = json_key_str(json_key_str_part3_for_custom_email_issuer); @@ -360,22 +360,23 @@ static void test_jwt_verifier_custom_email_issuer_success(void) { GPR_ASSERT(jwt != NULL); grpc_jwt_verifier_verify(verifier, NULL, jwt, expected_audience, on_verification_success, (void *)expected_user_data, - &call_list); + &closure_list); gpr_free(jwt); grpc_jwt_verifier_destroy(verifier); grpc_httpcli_set_override(NULL, NULL); - grpc_call_list_run(&call_list); + grpc_closure_list_run(&closure_list); } static int httpcli_get_jwk_set(const grpc_httpcli_request *request, gpr_timespec deadline, grpc_httpcli_response_cb on_response, - void *user_data, grpc_call_list *call_list) { + void *user_data, + grpc_closure_list *closure_list) { grpc_httpcli_response response = http_response(200, gpr_strdup(good_jwk_set)); GPR_ASSERT(request->handshaker == &grpc_httpcli_ssl); GPR_ASSERT(strcmp(request->host, "www.googleapis.com") == 0); GPR_ASSERT(strcmp(request->path, "/oauth2/v3/certs") == 0); - on_response(user_data, &response, call_list); + on_response(user_data, &response, closure_list); gpr_free(response.body); return 1; } @@ -384,7 +385,7 @@ static int httpcli_get_openid_config(const grpc_httpcli_request *request, gpr_timespec deadline, grpc_httpcli_response_cb on_response, void *user_data, - grpc_call_list *call_list) { + grpc_closure_list *closure_list) { grpc_httpcli_response response = http_response(200, gpr_strdup(good_openid_config)); GPR_ASSERT(request->handshaker == &grpc_httpcli_ssl); @@ -392,13 +393,13 @@ static int httpcli_get_openid_config(const grpc_httpcli_request *request, GPR_ASSERT(strcmp(request->path, GRPC_OPENID_CONFIG_URL_SUFFIX) == 0); grpc_httpcli_set_override(httpcli_get_jwk_set, httpcli_post_should_not_be_called); - on_response(user_data, &response, call_list); + on_response(user_data, &response, closure_list); gpr_free(response.body); return 1; } static void test_jwt_verifier_url_issuer_success(void) { - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; grpc_jwt_verifier *verifier = grpc_jwt_verifier_create(NULL, 0); char *jwt = NULL; char *key_str = json_key_str(json_key_str_part3_for_url_issuer); @@ -413,11 +414,11 @@ static void test_jwt_verifier_url_issuer_success(void) { GPR_ASSERT(jwt != NULL); grpc_jwt_verifier_verify(verifier, NULL, jwt, expected_audience, on_verification_success, (void *)expected_user_data, - &call_list); + &closure_list); gpr_free(jwt); grpc_jwt_verifier_destroy(verifier); grpc_httpcli_set_override(NULL, NULL); - grpc_call_list_run(&call_list); + grpc_closure_list_run(&closure_list); } static void on_verification_key_retrieval_error(void *user_data, @@ -431,17 +432,18 @@ static void on_verification_key_retrieval_error(void *user_data, static int httpcli_get_bad_json(const grpc_httpcli_request *request, gpr_timespec deadline, grpc_httpcli_response_cb on_response, - void *user_data, grpc_call_list *call_list) { + void *user_data, + grpc_closure_list *closure_list) { grpc_httpcli_response response = http_response(200, gpr_strdup("{\"bad\": \"stuff\"}")); GPR_ASSERT(request->handshaker == &grpc_httpcli_ssl); - on_response(user_data, &response, call_list); + on_response(user_data, &response, closure_list); gpr_free(response.body); return 1; } static void test_jwt_verifier_url_issuer_bad_config(void) { - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; grpc_jwt_verifier *verifier = grpc_jwt_verifier_create(NULL, 0); char *jwt = NULL; char *key_str = json_key_str(json_key_str_part3_for_url_issuer); @@ -456,15 +458,15 @@ static void test_jwt_verifier_url_issuer_bad_config(void) { GPR_ASSERT(jwt != NULL); grpc_jwt_verifier_verify(verifier, NULL, jwt, expected_audience, on_verification_key_retrieval_error, - (void *)expected_user_data, &call_list); + (void *)expected_user_data, &closure_list); gpr_free(jwt); grpc_jwt_verifier_destroy(verifier); grpc_httpcli_set_override(NULL, NULL); - grpc_call_list_run(&call_list); + grpc_closure_list_run(&closure_list); } static void test_jwt_verifier_bad_json_key(void) { - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; grpc_jwt_verifier *verifier = grpc_jwt_verifier_create(NULL, 0); char *jwt = NULL; char *key_str = json_key_str(json_key_str_part3_for_google_email_issuer); @@ -479,11 +481,11 @@ static void test_jwt_verifier_bad_json_key(void) { GPR_ASSERT(jwt != NULL); grpc_jwt_verifier_verify(verifier, NULL, jwt, expected_audience, on_verification_key_retrieval_error, - (void *)expected_user_data, &call_list); + (void *)expected_user_data, &closure_list); gpr_free(jwt); grpc_jwt_verifier_destroy(verifier); grpc_httpcli_set_override(NULL, NULL); - grpc_call_list_run(&call_list); + grpc_closure_list_run(&closure_list); } static void corrupt_jwt_sig(char *jwt) { @@ -512,7 +514,7 @@ static void on_verification_bad_signature(void *user_data, } static void test_jwt_verifier_bad_signature(void) { - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; grpc_jwt_verifier *verifier = grpc_jwt_verifier_create(NULL, 0); char *jwt = NULL; char *key_str = json_key_str(json_key_str_part3_for_url_issuer); @@ -528,17 +530,17 @@ static void test_jwt_verifier_bad_signature(void) { GPR_ASSERT(jwt != NULL); grpc_jwt_verifier_verify(verifier, NULL, jwt, expected_audience, on_verification_bad_signature, - (void *)expected_user_data, &call_list); + (void *)expected_user_data, &closure_list); gpr_free(jwt); grpc_jwt_verifier_destroy(verifier); grpc_httpcli_set_override(NULL, NULL); - grpc_call_list_run(&call_list); + grpc_closure_list_run(&closure_list); } static int httpcli_get_should_not_be_called( const grpc_httpcli_request *request, gpr_timespec deadline, grpc_httpcli_response_cb on_response, void *user_data, - grpc_call_list *call_list) { + grpc_closure_list *closure_list) { GPR_ASSERT(0); return 1; } @@ -552,16 +554,16 @@ static void on_verification_bad_format(void *user_data, } static void test_jwt_verifier_bad_format(void) { - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; grpc_jwt_verifier *verifier = grpc_jwt_verifier_create(NULL, 0); grpc_httpcli_set_override(httpcli_get_should_not_be_called, httpcli_post_should_not_be_called); grpc_jwt_verifier_verify(verifier, NULL, "bad jwt", expected_audience, on_verification_bad_format, - (void *)expected_user_data, &call_list); + (void *)expected_user_data, &closure_list); grpc_jwt_verifier_destroy(verifier); grpc_httpcli_set_override(NULL, NULL); - grpc_call_list_run(&call_list); + grpc_closure_list_run(&closure_list); } /* find verification key: bad jks, cannot find key in jks */ diff --git a/test/core/security/oauth2_utils.c b/test/core/security/oauth2_utils.c index fad52d0c59..30ad00cfbc 100644 --- a/test/core/security/oauth2_utils.c +++ b/test/core/security/oauth2_utils.c @@ -52,7 +52,7 @@ typedef struct { static void on_oauth2_response(void *user_data, grpc_credentials_md *md_elems, size_t num_md, grpc_credentials_status status, - grpc_call_list *call_list) { + grpc_closure_list *closure_list) { oauth2_request *request = user_data; char *token = NULL; gpr_slice token_slice; @@ -73,11 +73,12 @@ static void on_oauth2_response(void *user_data, grpc_credentials_md *md_elems, gpr_mu_unlock(GRPC_POLLSET_MU(&request->pollset)); } -static void do_nothing(void *unused, int success, grpc_call_list *call_list) {} +static void do_nothing(void *unused, int success, + grpc_closure_list *closure_list) {} char *grpc_test_fetch_oauth2_token_with_credentials(grpc_credentials *creds) { oauth2_request request; - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; grpc_closure do_nothing_closure; grpc_pollset_init(&request.pollset); request.is_done = 0; @@ -85,20 +86,20 @@ char *grpc_test_fetch_oauth2_token_with_credentials(grpc_credentials *creds) { grpc_closure_init(&do_nothing_closure, do_nothing, NULL); grpc_credentials_get_request_metadata( - creds, &request.pollset, "", on_oauth2_response, &request, &call_list); + creds, &request.pollset, "", on_oauth2_response, &request, &closure_list); - grpc_call_list_run(&call_list); + grpc_closure_list_run(&closure_list); gpr_mu_lock(GRPC_POLLSET_MU(&request.pollset)); while (!request.is_done) { grpc_pollset_worker worker; grpc_pollset_work(&request.pollset, &worker, gpr_now(GPR_CLOCK_MONOTONIC), - gpr_inf_future(GPR_CLOCK_MONOTONIC), &call_list); + gpr_inf_future(GPR_CLOCK_MONOTONIC), &closure_list); } gpr_mu_unlock(GRPC_POLLSET_MU(&request.pollset)); - grpc_pollset_shutdown(&request.pollset, &do_nothing_closure, &call_list); - grpc_call_list_run(&call_list); + grpc_pollset_shutdown(&request.pollset, &do_nothing_closure, &closure_list); + grpc_closure_list_run(&closure_list); grpc_pollset_destroy(&request.pollset); return request.token; } diff --git a/test/core/security/print_google_default_creds_token.c b/test/core/security/print_google_default_creds_token.c index 5604d869c8..646109c0a1 100644 --- a/test/core/security/print_google_default_creds_token.c +++ b/test/core/security/print_google_default_creds_token.c @@ -51,7 +51,7 @@ typedef struct { static void on_metadata_response(void *user_data, grpc_credentials_md *md_elems, size_t num_md, grpc_credentials_status status, - grpc_call_list *call_list) { + grpc_closure_list *closure_list) { synchronizer *sync = user_data; if (status == GRPC_CREDENTIALS_ERROR) { fprintf(stderr, "Fetching token failed.\n"); @@ -70,7 +70,7 @@ static void on_metadata_response(void *user_data, grpc_credentials_md *md_elems, int main(int argc, char **argv) { int result = 0; - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; synchronizer sync; grpc_credentials *creds = NULL; char *service_url = "https://test.foo.google.com/Foo"; @@ -93,15 +93,15 @@ int main(int argc, char **argv) { grpc_credentials_get_request_metadata(creds, &sync.pollset, service_url, on_metadata_response, &sync, - &call_list); + &closure_list); gpr_mu_lock(GRPC_POLLSET_MU(&sync.pollset)); while (!sync.is_done) { grpc_pollset_worker worker; grpc_pollset_work(&sync.pollset, &worker, gpr_now(GPR_CLOCK_MONOTONIC), - gpr_inf_future(GPR_CLOCK_MONOTONIC), &call_list); + gpr_inf_future(GPR_CLOCK_MONOTONIC), &closure_list); gpr_mu_unlock(GRPC_POLLSET_MU(&sync.pollset)); - grpc_call_list_run(&call_list); + grpc_closure_list_run(&closure_list); gpr_mu_lock(GRPC_POLLSET_MU(&sync.pollset)); } gpr_mu_unlock(GRPC_POLLSET_MU(&sync.pollset)); diff --git a/test/core/security/secure_endpoint_test.c b/test/core/security/secure_endpoint_test.c index 2e0f17f3ab..f68fde4c0a 100644 --- a/test/core/security/secure_endpoint_test.c +++ b/test/core/security/secure_endpoint_test.c @@ -49,15 +49,15 @@ static grpc_pollset g_pollset; static grpc_endpoint_test_fixture secure_endpoint_create_fixture_tcp_socketpair( size_t slice_size, gpr_slice *leftover_slices, size_t leftover_nslices) { - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; tsi_frame_protector *fake_read_protector = tsi_create_fake_protector(NULL); tsi_frame_protector *fake_write_protector = tsi_create_fake_protector(NULL); grpc_endpoint_test_fixture f; grpc_endpoint_pair tcp; tcp = grpc_iomgr_create_endpoint_pair("fixture", slice_size); - grpc_endpoint_add_to_pollset(tcp.client, &g_pollset, &call_list); - grpc_endpoint_add_to_pollset(tcp.server, &g_pollset, &call_list); + grpc_endpoint_add_to_pollset(tcp.client, &g_pollset, &closure_list); + grpc_endpoint_add_to_pollset(tcp.server, &g_pollset, &closure_list); if (leftover_nslices == 0) { f.client_ep = @@ -110,7 +110,7 @@ static grpc_endpoint_test_fixture secure_endpoint_create_fixture_tcp_socketpair( f.server_ep = grpc_secure_endpoint_create(fake_write_protector, tcp.server, NULL, 0); - grpc_call_list_run(&call_list); + grpc_closure_list_run(&closure_list); return f; } @@ -138,7 +138,8 @@ static grpc_endpoint_test_config configs[] = { secure_endpoint_create_fixture_tcp_socketpair_leftover, clean_up}, }; -static void inc_call_ctr(void *arg, int success, grpc_call_list *call_list) { +static void inc_call_ctr(void *arg, int success, + grpc_closure_list *closure_list) { ++*(int *)arg; } @@ -147,37 +148,38 @@ static void test_leftover(grpc_endpoint_test_config config, size_t slice_size) { gpr_slice_buffer incoming; gpr_slice s = gpr_slice_from_copied_string("hello world 12345678900987654321"); - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; int n = 0; grpc_closure done_closure; gpr_log(GPR_INFO, "Start test left over"); gpr_slice_buffer_init(&incoming); grpc_closure_init(&done_closure, inc_call_ctr, &n); - grpc_endpoint_read(f.client_ep, &incoming, &done_closure, &call_list); - grpc_call_list_run(&call_list); + grpc_endpoint_read(f.client_ep, &incoming, &done_closure, &closure_list); + grpc_closure_list_run(&closure_list); GPR_ASSERT(n == 1); GPR_ASSERT(incoming.count == 1); GPR_ASSERT(0 == gpr_slice_cmp(s, incoming.slices[0])); - grpc_endpoint_shutdown(f.client_ep, &call_list); - grpc_endpoint_shutdown(f.server_ep, &call_list); - grpc_endpoint_destroy(f.client_ep, &call_list); - grpc_endpoint_destroy(f.server_ep, &call_list); - grpc_call_list_run(&call_list); + grpc_endpoint_shutdown(f.client_ep, &closure_list); + grpc_endpoint_shutdown(f.server_ep, &closure_list); + grpc_endpoint_destroy(f.client_ep, &closure_list); + grpc_endpoint_destroy(f.server_ep, &closure_list); + grpc_closure_list_run(&closure_list); gpr_slice_unref(s); gpr_slice_buffer_destroy(&incoming); clean_up(); } -static void destroy_pollset(void *p, int success, grpc_call_list *call_list) { +static void destroy_pollset(void *p, int success, + grpc_closure_list *closure_list) { grpc_pollset_destroy(p); } int main(int argc, char **argv) { grpc_closure destroyed; - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; grpc_test_init(argc, argv); grpc_init(); @@ -185,8 +187,8 @@ int main(int argc, char **argv) { grpc_endpoint_tests(configs[0], &g_pollset); test_leftover(configs[1], 1); grpc_closure_init(&destroyed, destroy_pollset, &g_pollset); - grpc_pollset_shutdown(&g_pollset, &destroyed, &call_list); - grpc_call_list_run(&call_list); + grpc_pollset_shutdown(&g_pollset, &destroyed, &closure_list); + grpc_closure_list_run(&closure_list); grpc_shutdown(); return 0; diff --git a/test/core/security/verify_jwt.c b/test/core/security/verify_jwt.c index 417152a300..9be6ee6e33 100644 --- a/test/core/security/verify_jwt.c +++ b/test/core/security/verify_jwt.c @@ -89,7 +89,7 @@ int main(int argc, char **argv) { gpr_cmdline *cl; char *jwt = NULL; char *aud = NULL; - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; cl = gpr_cmdline_create("JWT verifier tool"); gpr_cmdline_add_string(cl, "jwt", "JSON web token to verify", &jwt); @@ -107,15 +107,15 @@ int main(int argc, char **argv) { sync.is_done = 0; grpc_jwt_verifier_verify(verifier, &sync.pollset, jwt, aud, - on_jwt_verification_done, &sync, &call_list); + on_jwt_verification_done, &sync, &closure_list); gpr_mu_lock(GRPC_POLLSET_MU(&sync.pollset)); while (!sync.is_done) { grpc_pollset_worker worker; grpc_pollset_work(&sync.pollset, &worker, gpr_now(GPR_CLOCK_MONOTONIC), - gpr_inf_future(GPR_CLOCK_MONOTONIC), &call_list); + gpr_inf_future(GPR_CLOCK_MONOTONIC), &closure_list); gpr_mu_unlock(GRPC_POLLSET_MU(&sync.pollset)); - grpc_call_list_run(&call_list); + grpc_closure_list_run(&closure_list); gpr_mu_lock(GRPC_POLLSET_MU(&sync.pollset)); } gpr_mu_unlock(GRPC_POLLSET_MU(&sync.pollset)); diff --git a/test/core/surface/completion_queue_test.c b/test/core/surface/completion_queue_test.c index 85a021da89..3dee8f23af 100644 --- a/test/core/surface/completion_queue_test.c +++ b/test/core/surface/completion_queue_test.c @@ -76,13 +76,13 @@ static void test_wait_empty(void) { } static void do_nothing_end_completion(void *arg, grpc_cq_completion *c, - grpc_call_list *call_list) {} + grpc_closure_list *closure_list) {} static void test_cq_end_op(void) { grpc_event ev; grpc_completion_queue *cc; grpc_cq_completion completion; - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; void *tag = create_test_tag(); LOG_TEST("test_cq_end_op"); @@ -91,7 +91,7 @@ static void test_cq_end_op(void) { grpc_cq_begin_op(cc); grpc_cq_end_op(cc, tag, 1, do_nothing_end_completion, NULL, &completion, - &call_list); + &closure_list); ev = grpc_completion_queue_next(cc, gpr_inf_past(GPR_CLOCK_REALTIME), NULL); GPR_ASSERT(ev.type == GRPC_OP_COMPLETE); @@ -99,7 +99,7 @@ static void test_cq_end_op(void) { GPR_ASSERT(ev.success); shutdown_and_destroy(cc); - GPR_ASSERT(grpc_call_list_empty(call_list)); + GPR_ASSERT(grpc_closure_list_empty(closure_list)); } static void test_shutdown_then_next_polling(void) { @@ -133,7 +133,7 @@ static void test_pluck(void) { grpc_completion_queue *cc; void *tags[128]; grpc_cq_completion completions[GPR_ARRAY_SIZE(tags)]; - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; unsigned i, j; LOG_TEST("test_pluck"); @@ -150,7 +150,7 @@ static void test_pluck(void) { for (i = 0; i < GPR_ARRAY_SIZE(tags); i++) { grpc_cq_begin_op(cc); grpc_cq_end_op(cc, tags[i], 1, do_nothing_end_completion, NULL, - &completions[i], &call_list); + &completions[i], &closure_list); } for (i = 0; i < GPR_ARRAY_SIZE(tags); i++) { @@ -162,7 +162,7 @@ static void test_pluck(void) { for (i = 0; i < GPR_ARRAY_SIZE(tags); i++) { grpc_cq_begin_op(cc); grpc_cq_end_op(cc, tags[i], 1, do_nothing_end_completion, NULL, - &completions[i], &call_list); + &completions[i], &closure_list); } for (i = 0; i < GPR_ARRAY_SIZE(tags); i++) { @@ -172,7 +172,7 @@ static void test_pluck(void) { } shutdown_and_destroy(cc); - GPR_ASSERT(grpc_call_list_empty(call_list)); + GPR_ASSERT(grpc_closure_list_empty(closure_list)); } #define TEST_THREAD_EVENTS 10000 @@ -193,14 +193,14 @@ gpr_timespec ten_seconds_time(void) { } static void free_completion(void *arg, grpc_cq_completion *completion, - grpc_call_list *call_list) { + grpc_closure_list *closure_list) { gpr_free(completion); } static void producer_thread(void *arg) { test_thread_options *opt = arg; int i; - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; gpr_log(GPR_INFO, "producer %d started", opt->id); gpr_event_set(&opt->on_started, (void *)(gpr_intptr)1); @@ -218,14 +218,14 @@ static void producer_thread(void *arg) { gpr_log(GPR_INFO, "producer %d phase 2", opt->id); for (i = 0; i < TEST_THREAD_EVENTS; i++) { grpc_cq_end_op(opt->cc, (void *)(gpr_intptr)1, 1, free_completion, NULL, - gpr_malloc(sizeof(grpc_cq_completion)), &call_list); + gpr_malloc(sizeof(grpc_cq_completion)), &closure_list); opt->events_triggered++; - grpc_call_list_run(&call_list); + grpc_closure_list_run(&closure_list); } gpr_log(GPR_INFO, "producer %d phase 2 done", opt->id); gpr_event_set(&opt->on_finished, (void *)(gpr_intptr)1); - GPR_ASSERT(grpc_call_list_empty(call_list)); + GPR_ASSERT(grpc_closure_list_empty(closure_list)); } static void consumer_thread(void *arg) { diff --git a/test/core/util/port_posix.c b/test/core/util/port_posix.c index 98b5686e91..1987700139 100644 --- a/test/core/util/port_posix.c +++ b/test/core/util/port_posix.c @@ -73,14 +73,14 @@ typedef struct freereq { } freereq; static void destroy_pollset_and_shutdown(void *p, int success, - grpc_call_list *call_list) { + grpc_closure_list *closure_list) { grpc_pollset_destroy(p); grpc_shutdown(); } static void freed_port_from_server(void *arg, const grpc_httpcli_response *response, - grpc_call_list *call_list) { + grpc_closure_list *closure_list) { freereq *pr = arg; gpr_mu_lock(GRPC_POLLSET_MU(&pr->pollset)); pr->done = 1; @@ -93,7 +93,7 @@ static void free_port_using_server(char *server, int port) { grpc_httpcli_request req; freereq pr; char *path; - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; grpc_closure shutdown_closure; grpc_init(); @@ -111,19 +111,19 @@ static void free_port_using_server(char *server, int port) { grpc_httpcli_context_init(&context); grpc_httpcli_get(&context, &pr.pollset, &req, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(10), freed_port_from_server, - &pr, &call_list); + &pr, &closure_list); gpr_mu_lock(GRPC_POLLSET_MU(&pr.pollset)); while (!pr.done) { grpc_pollset_worker worker; grpc_pollset_work(&pr.pollset, &worker, gpr_now(GPR_CLOCK_MONOTONIC), - GRPC_TIMEOUT_SECONDS_TO_DEADLINE(1), &call_list); + GRPC_TIMEOUT_SECONDS_TO_DEADLINE(1), &closure_list); } gpr_mu_unlock(GRPC_POLLSET_MU(&pr.pollset)); grpc_httpcli_context_destroy(&context); - grpc_call_list_run(&call_list); - grpc_pollset_shutdown(&pr.pollset, &shutdown_closure, &call_list); - grpc_call_list_run(&call_list); + grpc_closure_list_run(&closure_list); + grpc_pollset_shutdown(&pr.pollset, &shutdown_closure, &closure_list); + grpc_closure_list_run(&closure_list); gpr_free(path); } @@ -210,7 +210,7 @@ typedef struct portreq { static void got_port_from_server(void *arg, const grpc_httpcli_response *response, - grpc_call_list *call_list) { + grpc_closure_list *closure_list) { size_t i; int port = 0; portreq *pr = arg; @@ -226,7 +226,7 @@ static void got_port_from_server(void *arg, sleep(1); grpc_httpcli_get(pr->ctx, &pr->pollset, &req, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(10), got_port_from_server, - pr, call_list); + pr, closure_list); return; } GPR_ASSERT(response); @@ -246,7 +246,7 @@ static int pick_port_using_server(char *server) { grpc_httpcli_context context; grpc_httpcli_request req; portreq pr; - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; grpc_closure shutdown_closure; grpc_init(); @@ -266,19 +266,19 @@ static int pick_port_using_server(char *server) { grpc_httpcli_context_init(&context); grpc_httpcli_get(&context, &pr.pollset, &req, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(10), got_port_from_server, - &pr, &call_list); - grpc_call_list_run(&call_list); + &pr, &closure_list); + grpc_closure_list_run(&closure_list); gpr_mu_lock(GRPC_POLLSET_MU(&pr.pollset)); while (pr.port == -1) { grpc_pollset_worker worker; grpc_pollset_work(&pr.pollset, &worker, gpr_now(GPR_CLOCK_MONOTONIC), - GRPC_TIMEOUT_SECONDS_TO_DEADLINE(1), &call_list); + GRPC_TIMEOUT_SECONDS_TO_DEADLINE(1), &closure_list); } gpr_mu_unlock(GRPC_POLLSET_MU(&pr.pollset)); grpc_httpcli_context_destroy(&context); - grpc_pollset_shutdown(&pr.pollset, &shutdown_closure, &call_list); - grpc_call_list_run(&call_list); + grpc_pollset_shutdown(&pr.pollset, &shutdown_closure, &closure_list); + grpc_closure_list_run(&closure_list); return pr.port; } diff --git a/test/core/util/reconnect_server.c b/test/core/util/reconnect_server.c index eeb3ecb55a..8092cbc73a 100644 --- a/test/core/util/reconnect_server.c +++ b/test/core/util/reconnect_server.c @@ -66,15 +66,15 @@ static void pretty_print_backoffs(reconnect_server *server) { } static void on_connect(void *arg, grpc_endpoint *tcp, - grpc_call_list *call_list) { + grpc_closure_list *closure_list) { char *peer; char *last_colon; reconnect_server *server = (reconnect_server *)arg; gpr_timespec now = gpr_now(GPR_CLOCK_REALTIME); timestamp_list *new_tail; peer = grpc_endpoint_get_peer(tcp); - grpc_endpoint_shutdown(tcp, call_list); - grpc_endpoint_destroy(tcp, call_list); + grpc_endpoint_shutdown(tcp, closure_list); + grpc_endpoint_destroy(tcp, closure_list); if (peer) { last_colon = strrchr(peer, ':'); if (server->peer == NULL) { @@ -115,7 +115,7 @@ void reconnect_server_init(reconnect_server *server) { void reconnect_server_start(reconnect_server *server, int port) { struct sockaddr_in addr; int port_added; - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; addr.sin_family = AF_INET; addr.sin_port = htons((gpr_uint16)port); @@ -127,10 +127,10 @@ void reconnect_server_start(reconnect_server *server, int port) { GPR_ASSERT(port_added == port); grpc_tcp_server_start(server->tcp_server, server->pollsets, 1, on_connect, - server, &call_list); + server, &closure_list); gpr_log(GPR_INFO, "reconnect tcp server listening on 0.0.0.0:%d", port); - grpc_call_list_run(&call_list); + grpc_closure_list_run(&closure_list); } void reconnect_server_poll(reconnect_server *server, int seconds) { @@ -138,12 +138,12 @@ void reconnect_server_poll(reconnect_server *server, int seconds) { gpr_timespec deadline = gpr_time_add(gpr_now(GPR_CLOCK_MONOTONIC), gpr_time_from_seconds(seconds, GPR_TIMESPAN)); - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; gpr_mu_lock(GRPC_POLLSET_MU(&server->pollset)); grpc_pollset_work(&server->pollset, &worker, gpr_now(GPR_CLOCK_MONOTONIC), - deadline, &call_list); + deadline, &closure_list); gpr_mu_unlock(GRPC_POLLSET_MU(&server->pollset)); - grpc_call_list_run(&call_list); + grpc_closure_list_run(&closure_list); } void reconnect_server_clear_timestamps(reconnect_server *server) { @@ -158,18 +158,20 @@ void reconnect_server_clear_timestamps(reconnect_server *server) { server->peer = NULL; } -static void do_nothing(void *ignored, int success, grpc_call_list *call_list) {} +static void do_nothing(void *ignored, int success, + grpc_closure_list *closure_list) {} void reconnect_server_destroy(reconnect_server *server) { - grpc_call_list call_list = GRPC_CALL_LIST_INIT; + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; grpc_closure do_nothing_closure[2]; grpc_closure_init(&do_nothing_closure[0], do_nothing, NULL); grpc_closure_init(&do_nothing_closure[1], do_nothing, NULL); grpc_tcp_server_destroy(server->tcp_server, &do_nothing_closure[0], - &call_list); + &closure_list); reconnect_server_clear_timestamps(server); - grpc_pollset_shutdown(&server->pollset, &do_nothing_closure[1], &call_list); - grpc_call_list_run(&call_list); + grpc_pollset_shutdown(&server->pollset, &do_nothing_closure[1], + &closure_list); + grpc_closure_list_run(&closure_list); grpc_pollset_destroy(&server->pollset); grpc_shutdown(); } |