Move argument passing to start of list

pull/3423/head
Craig Tiller 9 years ago
parent f5768a6765
commit e7db29f8c7
  1. 2
      src/core/iomgr/iomgr.c
  2. 2
      src/core/iomgr/resolve_address_posix.c
  3. 6
      src/core/security/credentials.c
  4. 6
      src/core/security/google_default_credentials.c
  5. 4
      src/core/security/server_auth_filter.c
  6. 4
      src/core/security/server_secure_chttp2.c
  7. 20
      src/core/surface/call.c
  8. 4
      src/core/surface/channel.c
  9. 8
      src/core/surface/channel_connectivity.c
  10. 8
      src/core/surface/channel_create.c
  11. 10
      src/core/surface/completion_queue.c
  12. 2
      src/core/surface/lame_client.c
  13. 8
      src/core/surface/secure_channel_create.c
  14. 20
      src/core/surface/server.c
  15. 2
      src/core/surface/server_chttp2.c
  16. 20
      test/core/bad_client/bad_client.c
  17. 8
      test/core/channel/channel_stack_test.c
  18. 2
      test/core/client_config/lb_policies_test.c
  19. 12
      test/core/end2end/fixtures/h2_sockpair+trace.c
  20. 12
      test/core/end2end/fixtures/h2_sockpair.c
  21. 12
      test/core/end2end/fixtures/h2_sockpair_1byte.c
  22. 10
      test/core/httpcli/httpcli_test.c
  23. 28
      test/core/iomgr/alarm_list_test.c
  24. 6
      test/core/iomgr/endpoint_pair_test.c
  25. 14
      test/core/iomgr/endpoint_tests.c
  26. 4
      test/core/iomgr/fd_conservation_posix_test.c
  27. 22
      test/core/iomgr/fd_posix_test.c
  28. 16
      test/core/iomgr/tcp_client_posix_test.c
  29. 32
      test/core/iomgr/tcp_posix_test.c
  30. 16
      test/core/iomgr/tcp_server_posix_test.c
  31. 12
      test/core/iomgr/udp_server_test.c
  32. 8
      test/core/iomgr/workqueue_test.c
  33. 32
      test/core/security/credentials_test.c
  34. 14
      test/core/security/jwt_verifier_test.c
  35. 6
      test/core/security/oauth2_utils.c
  36. 4
      test/core/security/print_google_default_creds_token.c
  37. 16
      test/core/security/secure_endpoint_test.c
  38. 4
      test/core/security/verify_jwt.c
  39. 8
      test/core/surface/completion_queue_test.c
  40. 12
      test/core/util/port_posix.c
  41. 8
      test/core/util/reconnect_server.c

@ -113,7 +113,7 @@ grpc_iomgr_shutdown (void)
}
last_warning_time = gpr_now (GPR_CLOCK_REALTIME);
}
if (grpc_alarm_check (gpr_inf_future (GPR_CLOCK_MONOTONIC), NULL, &closure_list))
if (grpc_alarm_check (gpr_inf_future (&exec_ctx, GPR_CLOCK_MONOTONIC), NULL))
{
gpr_mu_unlock (&g_mu);
grpc_exec_ctx_finish (&exec_ctx);

@ -166,7 +166,7 @@ do_request_thread (void *rp)
grpc_resolve_cb cb = r->cb;
gpr_free (r->name);
gpr_free (r->default_port);
cb (arg, resolved, &closure_list);
cb (&exec_ctx, arg, resolved);
grpc_iomgr_unregister_object (&r->iomgr_object);
gpr_free (r);
grpc_exec_ctx_finish (&exec_ctx);

@ -810,7 +810,7 @@ on_simulated_token_fetch_done (void *user_data)
grpc_credentials_metadata_request *r = (grpc_credentials_metadata_request *) user_data;
grpc_md_only_test_credentials *c = (grpc_md_only_test_credentials *) r->creds;
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
r->cb (r->user_data, c->md_store->entries, c->md_store->num_entries, GRPC_CREDENTIALS_OK, &closure_list);
r->cb (&exec_ctx, r->user_data, c->md_store->entries, c->md_store->num_entries, GRPC_CREDENTIALS_OK);
grpc_credentials_metadata_request_destroy (r);
grpc_exec_ctx_finish (&exec_ctx);
}
@ -1330,7 +1330,7 @@ plugin_md_request_metadata_ready (void *request, const grpc_metadata * md, size_
{
gpr_log (GPR_ERROR, "Getting metadata from plugin failed with error: %s", error_details);
}
r->cb (r->user_data, NULL, 0, GRPC_CREDENTIALS_ERROR, &closure_list);
r->cb (&exec_ctx, r->user_data, NULL, 0, GRPC_CREDENTIALS_ERROR);
}
else
{
@ -1345,7 +1345,7 @@ plugin_md_request_metadata_ready (void *request, const grpc_metadata * md, size_
md_array[i].value = gpr_slice_from_copied_buffer (md[i].value, md[i].value_length);
}
}
r->cb (r->user_data, md_array, num_md, GRPC_CREDENTIALS_OK, &closure_list);
r->cb (&exec_ctx, r->user_data, md_array, num_md, GRPC_CREDENTIALS_OK);
if (md_array != NULL)
{
for (i = 0; i < num_md; i++)

@ -121,7 +121,7 @@ is_stack_running_on_compute_engine (void)
grpc_httpcli_context_init (&context);
grpc_httpcli_get (&context, &detector.pollset, &request, gpr_time_add (gpr_now (GPR_CLOCK_REALTIME), max_detection_delay), on_compute_engine_detection_http_response, &detector, &closure_list);
grpc_httpcli_get (&context, &detector.pollset, &request, gpr_time_add (gpr_now (&exec_ctx, GPR_CLOCK_REALTIME), max_detection_delay), on_compute_engine_detection_http_response, &detector);
grpc_exec_ctx_finish (&exec_ctx);
@ -131,13 +131,13 @@ is_stack_running_on_compute_engine (void)
while (!detector.is_done)
{
grpc_pollset_worker worker;
grpc_pollset_work (&detector.pollset, &worker, gpr_now (GPR_CLOCK_MONOTONIC), gpr_inf_future (GPR_CLOCK_MONOTONIC), &closure_list);
grpc_pollset_work (&detector.pollset, &worker, gpr_now (GPR_CLOCK_MONOTONIC), gpr_inf_future (&exec_ctx, GPR_CLOCK_MONOTONIC));
}
gpr_mu_unlock (GRPC_POLLSET_MU (&detector.pollset));
grpc_httpcli_context_destroy (&context);
grpc_closure_init (&destroy_closure, destroy_pollset, &detector.pollset);
grpc_pollset_shutdown (&detector.pollset, &destroy_closure, &closure_list);
grpc_pollset_shutdown (&exec_ctx, &detector.pollset, &destroy_closure);
grpc_exec_ctx_finish (&exec_ctx);
return detector.success;

@ -134,7 +134,7 @@ on_md_processing_done (void *user_data, const grpc_metadata * consumed_md, size_
calld->num_consumed_md = num_consumed_md;
grpc_metadata_batch_filter (&calld->md_op->data.metadata, remove_consumed_md, elem);
grpc_metadata_array_destroy (&calld->md);
calld->on_done_recv->cb (calld->on_done_recv->cb_arg, 1, &closure_list);
calld->on_done_recv->cb (&exec_ctx, calld->on_done_recv->cb_arg, 1);
}
else
{
@ -144,7 +144,7 @@ on_md_processing_done (void *user_data, const grpc_metadata * consumed_md, size_
message = gpr_slice_from_copied_string (error_details);
grpc_sopb_reset (calld->recv_ops);
grpc_transport_stream_op_add_close (&calld->transport_op, status, &message);
grpc_call_next_op (elem, &calld->transport_op, &closure_list);
grpc_call_next_op (&exec_ctx, elem, &calld->transport_op);
}
grpc_exec_ctx_finish (&exec_ctx);

@ -300,7 +300,7 @@ grpc_server_add_secure_http2_port (grpc_server * server, const char *addr, grpc_
gpr_ref_init (&state->refcount, 1);
/* Register with the server only upon success */
grpc_server_add_listener (server, state, start, destroy, &closure_list);
grpc_server_add_listener (&exec_ctx, server, state, start, destroy);
grpc_exec_ctx_finish (&exec_ctx);
return port_num;
@ -317,7 +317,7 @@ error:
}
if (tcp)
{
grpc_tcp_server_destroy (tcp, NULL, &closure_list);
grpc_tcp_server_destroy (&exec_ctx, tcp, NULL);
}
if (state)
{

@ -355,7 +355,7 @@ grpc_call_create (grpc_channel * channel, grpc_call * parent_call, gpr_uint32 pr
GRPC_CALL_INTERNAL_REF (call, "receiving");
initial_op_ptr = &initial_op;
}
grpc_call_stack_init (channel_stack, server_transport_data, initial_op_ptr, CALL_STACK_FROM_CALL (call), &closure_list);
grpc_call_stack_init (channel_stack, server_transport_data, initial_op_ptr, CALL_STACK_FROM_CALL (&exec_ctx, call));
if (parent_call != NULL)
{
GRPC_CALL_INTERNAL_REF (parent_call, "child");
@ -402,7 +402,7 @@ grpc_call_create (grpc_channel * channel, grpc_call * parent_call, gpr_uint32 pr
}
if (gpr_time_cmp (send_deadline, gpr_inf_future (send_deadline.clock_type)) != 0)
{
set_deadline_alarm (call, send_deadline, &closure_list);
set_deadline_alarm (&exec_ctx, call, send_deadline);
}
grpc_exec_ctx_finish (&exec_ctx);
return call;
@ -1411,7 +1411,7 @@ grpc_call_destroy (grpc_call * c)
c->sibling_next->sibling_prev = c->sibling_prev;
}
gpr_mu_unlock (&parent->mu);
GRPC_CALL_INTERNAL_UNREF (parent, "child", &closure_list);
GRPC_CALL_INTERNAL_UNREF (&exec_ctx, parent, "child");
}
lock (c);
@ -1419,13 +1419,13 @@ grpc_call_destroy (grpc_call * c)
c->destroy_called = 1;
if (c->have_alarm)
{
grpc_alarm_cancel (&c->alarm, &closure_list);
grpc_alarm_cancel (&exec_ctx, &c->alarm);
}
cancel = c->read_state != READ_STATE_STREAM_CLOSED;
unlock (c, &closure_list);
unlock (&exec_ctx, c);
if (cancel)
grpc_call_cancel (c, NULL);
GRPC_CALL_INTERNAL_UNREF (c, "destroy", &closure_list);
GRPC_CALL_INTERNAL_UNREF (&exec_ctx, c, "destroy");
grpc_exec_ctx_finish (&exec_ctx);
}
@ -1444,7 +1444,7 @@ grpc_call_cancel_with_status (grpc_call * c, grpc_status_code status, const char
GPR_ASSERT (reserved == NULL);
lock (c);
r = cancel_with_status (c, status, description);
unlock (c, &closure_list);
unlock (&exec_ctx, c);
grpc_exec_ctx_finish (&exec_ctx);
return r;
}
@ -1516,7 +1516,7 @@ grpc_call_get_peer (grpc_call * call)
{
grpc_call_element *elem = CALL_ELEM_FROM_CALL (call, 0);
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
char *result = elem->filter->get_peer (elem, &closure_list);
char *result = elem->filter->get_peer (&exec_ctx, elem);
grpc_exec_ctx_finish (&exec_ctx);
return result;
}
@ -1756,7 +1756,7 @@ grpc_call_start_batch (grpc_call * call, const grpc_op * ops, size_t nops, void
{
grpc_cq_begin_op (call->cq);
GRPC_CALL_INTERNAL_REF (call, "completion");
grpc_cq_end_op (call->cq, tag, 1, done_completion, call, allocate_completion (call), &closure_list);
grpc_cq_end_op (call->cq, tag, 1, done_completion, call, allocate_completion (&exec_ctx, call));
error = GRPC_CALL_OK;
goto done;
}
@ -1992,7 +1992,7 @@ grpc_call_start_batch (grpc_call * call, const grpc_op * ops, size_t nops, void
GRPC_CALL_INTERNAL_REF (call, "completion");
grpc_cq_begin_op (call->cq);
error = grpc_call_start_ioreq_and_call_back (call, reqs, out, finish_func, tag, &closure_list);
error = grpc_call_start_ioreq_and_call_back (&exec_ctx, call, reqs, out, finish_func, tag);
done:
grpc_exec_ctx_finish (&exec_ctx);
return error;

@ -322,9 +322,9 @@ grpc_channel_destroy (grpc_channel * channel)
memset (&op, 0, sizeof (op));
op.disconnect = 1;
elem = grpc_channel_stack_element (CHANNEL_STACK_FROM_CHANNEL (channel), 0);
elem->filter->start_transport_op (elem, &op, &closure_list);
elem->filter->start_transport_op (&exec_ctx, elem, &op);
GRPC_CHANNEL_INTERNAL_UNREF (channel, "channel", &closure_list);
GRPC_CHANNEL_INTERNAL_UNREF (&exec_ctx, channel, "channel");
grpc_exec_ctx_finish (&exec_ctx);
}

@ -52,7 +52,7 @@ grpc_channel_check_connectivity_state (grpc_channel * channel, int try_to_connec
gpr_log (GPR_ERROR, "grpc_channel_check_connectivity_state called on something that is " "not a client channel, but '%s'", client_channel_elem->filter->name);
return GRPC_CHANNEL_FATAL_FAILURE;
}
state = grpc_client_channel_check_connectivity_state (client_channel_elem, try_to_connect, &closure_list);
state = grpc_client_channel_check_connectivity_state (&exec_ctx, client_channel_elem, try_to_connect);
grpc_exec_ctx_finish (&exec_ctx);
return state;
}
@ -195,7 +195,7 @@ grpc_channel_watch_connectivity_state (grpc_channel * channel, grpc_connectivity
w->tag = tag;
w->channel = channel;
grpc_alarm_init (&w->alarm, gpr_convert_clock_type (deadline, GPR_CLOCK_MONOTONIC), timeout_complete, w, gpr_now (GPR_CLOCK_MONOTONIC), &closure_list);
grpc_alarm_init (&w->alarm, gpr_convert_clock_type (deadline, GPR_CLOCK_MONOTONIC), timeout_complete, w, gpr_now (&exec_ctx, GPR_CLOCK_MONOTONIC));
if (client_channel_elem->filter != &grpc_client_channel_filter)
{
@ -205,8 +205,8 @@ grpc_channel_watch_connectivity_state (grpc_channel * channel, grpc_connectivity
else
{
GRPC_CHANNEL_INTERNAL_REF (channel, "watch_connectivity");
grpc_client_channel_add_interested_party (client_channel_elem, grpc_cq_pollset (cq), &closure_list);
grpc_client_channel_watch_connectivity_state (client_channel_elem, &w->state, &w->on_complete, &closure_list);
grpc_client_channel_add_interested_party (client_channel_elem, grpc_cq_pollset (&exec_ctx, cq));
grpc_client_channel_watch_connectivity_state (&exec_ctx, client_channel_elem, &w->state, &w->on_complete);
}
grpc_exec_ctx_finish (&exec_ctx);

@ -208,7 +208,7 @@ grpc_insecure_channel_create (const char *target, const grpc_channel_args * args
filters[n++] = &grpc_client_channel_filter;
GPR_ASSERT (n <= MAX_FILTERS);
channel = grpc_channel_create_from_filters (target, filters, n, args, mdctx, 1, &closure_list);
channel = grpc_channel_create_from_filters (&exec_ctx, target, filters, n, args, mdctx, 1);
f = gpr_malloc (sizeof (*f));
f->base.vtable = &subchannel_factory_vtable;
@ -224,9 +224,9 @@ grpc_insecure_channel_create (const char *target, const grpc_channel_args * args
return NULL;
}
grpc_client_channel_set_resolver (grpc_channel_get_channel_stack (channel), resolver, &closure_list);
GRPC_RESOLVER_UNREF (resolver, "create", &closure_list);
grpc_subchannel_factory_unref (&f->base, &closure_list);
grpc_client_channel_set_resolver (grpc_channel_get_channel_stack (&exec_ctx, channel), resolver);
GRPC_RESOLVER_UNREF (&exec_ctx, resolver, "create");
grpc_subchannel_factory_unref (&exec_ctx, &f->base);
grpc_exec_ctx_finish (&exec_ctx);

@ -214,7 +214,7 @@ grpc_completion_queue_next (grpc_completion_queue * cc, gpr_timespec deadline, v
ret.type = GRPC_OP_COMPLETE;
ret.success = c->next & 1u;
ret.tag = c->tag;
c->done (c->done_arg, c, &closure_list);
c->done (&exec_ctx, c->done_arg, c);
break;
}
if (cc->shutdown)
@ -233,7 +233,7 @@ grpc_completion_queue_next (grpc_completion_queue * cc, gpr_timespec deadline, v
break;
}
first_loop = 0;
grpc_pollset_work (&cc->pollset, &worker, now, deadline, &closure_list);
grpc_pollset_work (&exec_ctx, &cc->pollset, &worker, now, deadline);
}
GRPC_SURFACE_TRACE_RETURNED_EVENT (cc, &ret);
GRPC_CQ_INTERNAL_UNREF (cc, "next");
@ -304,7 +304,7 @@ grpc_completion_queue_pluck (grpc_completion_queue * cc, void *tag, gpr_timespec
ret.type = GRPC_OP_COMPLETE;
ret.success = c->next & 1u;
ret.tag = c->tag;
c->done (c->done_arg, c, &closure_list);
c->done (&exec_ctx, c->done_arg, c);
goto done;
}
prev = c;
@ -335,7 +335,7 @@ grpc_completion_queue_pluck (grpc_completion_queue * cc, void *tag, gpr_timespec
break;
}
first_loop = 0;
grpc_pollset_work (&cc->pollset, &worker, now, deadline, &closure_list);
grpc_pollset_work (&exec_ctx, &cc->pollset, &worker, now, deadline);
del_plucker (cc, tag, &worker);
}
done:
@ -366,7 +366,7 @@ grpc_completion_queue_shutdown (grpc_completion_queue * cc)
GPR_ASSERT (!cc->shutdown);
cc->shutdown = 1;
gpr_mu_unlock (GRPC_POLLSET_MU (&cc->pollset));
grpc_pollset_shutdown (&cc->pollset, &cc->pollset_destroy_done, &closure_list);
grpc_pollset_shutdown (&exec_ctx, &cc->pollset, &cc->pollset_destroy_done);
}
grpc_exec_ctx_finish (&exec_ctx);
}

@ -165,7 +165,7 @@ grpc_lame_client_channel_create (const char *target, grpc_status_code error_code
channel_data *chand;
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
static const grpc_channel_filter *filters[] = { &lame_filter };
channel = grpc_channel_create_from_filters (target, filters, 1, NULL, grpc_mdctx_create (), 1, &closure_list);
channel = grpc_channel_create_from_filters (target, filters, 1, NULL, grpc_mdctx_create (&exec_ctx, ), 1);
elem = grpc_channel_stack_element (grpc_channel_get_channel_stack (channel), 0);
GPR_ASSERT (elem->filter == &lame_filter);
chand = (channel_data *) elem->channel_data;

@ -284,7 +284,7 @@ grpc_secure_channel_create (grpc_credentials * creds, const char *target, const
filters[n++] = &grpc_client_channel_filter;
GPR_ASSERT (n <= MAX_FILTERS);
channel = grpc_channel_create_from_filters (target, filters, n, args_copy, mdctx, 1, &closure_list);
channel = grpc_channel_create_from_filters (&exec_ctx, target, filters, n, args_copy, mdctx, 1);
f = gpr_malloc (sizeof (*f));
f->base.vtable = &subchannel_factory_vtable;
@ -302,9 +302,9 @@ grpc_secure_channel_create (grpc_credentials * creds, const char *target, const
return NULL;
}
grpc_client_channel_set_resolver (grpc_channel_get_channel_stack (channel), resolver, &closure_list);
GRPC_RESOLVER_UNREF (resolver, "create", &closure_list);
grpc_subchannel_factory_unref (&f->base, &closure_list);
grpc_client_channel_set_resolver (grpc_channel_get_channel_stack (&exec_ctx, channel), resolver);
GRPC_RESOLVER_UNREF (&exec_ctx, resolver, "create");
grpc_subchannel_factory_unref (&exec_ctx, &f->base);
GRPC_SECURITY_CONNECTOR_UNREF (&connector->base, "channel_create");
grpc_channel_args_destroy (args_copy);

@ -991,7 +991,7 @@ grpc_server_start (grpc_server * server)
for (l = server->listeners; l; l = l->next)
{
l->start (server, l->arg, server->pollsets, server->cq_count, &closure_list);
l->start (&exec_ctx, server, l->arg, server->pollsets, server->cq_count);
}
grpc_exec_ctx_finish (&exec_ctx);
@ -1124,7 +1124,7 @@ grpc_server_shutdown_and_notify (grpc_server * server, grpc_completion_queue * c
grpc_cq_begin_op (cq);
if (server->shutdown_published)
{
grpc_cq_end_op (cq, tag, 1, done_published_shutdown, NULL, gpr_malloc (sizeof (grpc_cq_completion)), &closure_list);
grpc_cq_end_op (cq, tag, 1, done_published_shutdown, NULL, gpr_malloc (sizeof (&exec_ctx, grpc_cq_completion)));
gpr_mu_unlock (&server->mu_global);
goto done;
}
@ -1144,21 +1144,21 @@ grpc_server_shutdown_and_notify (grpc_server * server, grpc_completion_queue * c
/* collect all unregistered then registered calls */
gpr_mu_lock (&server->mu_call);
kill_pending_work_locked (server, &closure_list);
kill_pending_work_locked (&exec_ctx, server);
gpr_mu_unlock (&server->mu_call);
gpr_atm_rel_store (&server->shutdown_flag, 1);
maybe_finish_shutdown (server, &closure_list);
maybe_finish_shutdown (&exec_ctx, server);
gpr_mu_unlock (&server->mu_global);
/* Shutdown listeners */
for (l = server->listeners; l; l = l->next)
{
grpc_closure_init (&l->destroy_done, listener_destroy_done, server);
l->destroy (server, l->arg, &l->destroy_done, &closure_list);
l->destroy (&exec_ctx, server, l->arg, &l->destroy_done);
}
channel_broadcaster_shutdown (&broadcaster, 1, 0, &closure_list);
channel_broadcaster_shutdown (&exec_ctx, &broadcaster, 1, 0);
done:
grpc_exec_ctx_finish (&exec_ctx);
@ -1174,7 +1174,7 @@ grpc_server_cancel_all_calls (grpc_server * server)
channel_broadcaster_init (server, &broadcaster);
gpr_mu_unlock (&server->mu_global);
channel_broadcaster_shutdown (&broadcaster, 0, 1, &closure_list);
channel_broadcaster_shutdown (&exec_ctx, &broadcaster, 0, 1);
grpc_exec_ctx_finish (&exec_ctx);
}
@ -1197,7 +1197,7 @@ grpc_server_destroy (grpc_server * server)
gpr_mu_unlock (&server->mu_global);
server_unref (server, &closure_list);
server_unref (&exec_ctx, server);
grpc_exec_ctx_finish (&exec_ctx);
}
@ -1297,7 +1297,7 @@ grpc_server_request_call (grpc_server * server, grpc_call ** call, grpc_call_det
rc->call = call;
rc->data.batch.details = details;
rc->data.batch.initial_metadata = initial_metadata;
error = queue_call_request (server, rc, &closure_list);
error = queue_call_request (&exec_ctx, server, rc);
done:
grpc_exec_ctx_finish (&exec_ctx);
return error;
@ -1327,7 +1327,7 @@ grpc_server_request_registered_call (grpc_server * server, void *rm, grpc_call *
rc->data.registered.deadline = deadline;
rc->data.registered.initial_metadata = initial_metadata;
rc->data.registered.optional_payload = optional_payload;
error = queue_call_request (server, rc, &closure_list);
error = queue_call_request (&exec_ctx, server, rc);
done:
grpc_exec_ctx_finish (&exec_ctx);
return error;

@ -135,7 +135,7 @@ grpc_server_add_insecure_http2_port (grpc_server * server, const char *addr)
grpc_resolved_addresses_destroy (resolved);
/* Register with the server only upon success */
grpc_server_add_listener (server, tcp, start, destroy, &closure_list);
grpc_server_add_listener (&exec_ctx, server, tcp, start, destroy);
goto done;
/* Error path: cleanup and return */

@ -77,7 +77,7 @@ server_setup_transport (void *ts, grpc_transport * transport, grpc_mdctx * mdctx
&grpc_http_server_filter
};
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_server_setup_transport (a->server, transport, extra_filters, GPR_ARRAY_SIZE (extra_filters), mdctx, grpc_server_get_channel_args (a->server), &closure_list);
grpc_server_setup_transport (a->server, transport, extra_filters, GPR_ARRAY_SIZE (extra_filters), mdctx, grpc_server_get_channel_args (&exec_ctx, a->server));
grpc_exec_ctx_finish (&exec_ctx);
}
@ -116,14 +116,14 @@ grpc_run_bad_client_test (grpc_bad_client_server_side_validator validator, const
a.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, &closure_list);
transport = grpc_create_chttp2_transport (&exec_ctx, NULL, sfd.server, mdctx, 0);
server_setup_transport (&a, transport, mdctx);
grpc_chttp2_transport_start_reading (transport, NULL, 0, &closure_list);
grpc_chttp2_transport_start_reading (&exec_ctx, transport, NULL, 0);
grpc_exec_ctx_finish (&exec_ctx);
/* Bind everything into the same pollset */
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);
grpc_endpoint_add_to_pollset (sfd.client, grpc_cq_pollset (&exec_ctx, a.cq));
grpc_endpoint_add_to_pollset (sfd.server, grpc_cq_pollset (&exec_ctx, a.cq));
/* Check a ground truth */
GPR_ASSERT (grpc_server_has_open_connections (a.server));
@ -136,7 +136,7 @@ grpc_run_bad_client_test (grpc_bad_client_server_side_validator validator, const
grpc_closure_init (&done_write_closure, done_write, &a);
/* Write data */
grpc_endpoint_write (sfd.client, &outgoing, &done_write_closure, &closure_list);
grpc_endpoint_write (&exec_ctx, sfd.client, &outgoing, &done_write_closure);
grpc_exec_ctx_finish (&exec_ctx);
/* Await completion */
@ -144,8 +144,8 @@ grpc_run_bad_client_test (grpc_bad_client_server_side_validator validator, const
if (flags & GRPC_BAD_CLIENT_DISCONNECT)
{
grpc_endpoint_shutdown (sfd.client, &closure_list);
grpc_endpoint_destroy (sfd.client, &closure_list);
grpc_endpoint_shutdown (&exec_ctx, sfd.client);
grpc_endpoint_destroy (&exec_ctx, sfd.client);
grpc_exec_ctx_finish (&exec_ctx);
sfd.client = NULL;
}
@ -155,8 +155,8 @@ grpc_run_bad_client_test (grpc_bad_client_server_side_validator validator, const
/* Shutdown */
if (sfd.client)
{
grpc_endpoint_shutdown (sfd.client, &closure_list);
grpc_endpoint_destroy (sfd.client, &closure_list);
grpc_endpoint_shutdown (&exec_ctx, sfd.client);
grpc_endpoint_destroy (&exec_ctx, sfd.client);
grpc_exec_ctx_finish (&exec_ctx);
}
grpc_server_shutdown_and_notify (a.server, a.cq, NULL);

@ -120,14 +120,14 @@ test_create_channel_stack (void)
chan_args.args = &arg;
channel_stack = gpr_malloc (grpc_channel_stack_size (&filters, 1));
grpc_channel_stack_init (&filters, 1, NULL, &chan_args, metadata_context, channel_stack, &closure_list);
grpc_channel_stack_init (&exec_ctx, &filters, 1, NULL, &chan_args, metadata_context, channel_stack);
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, &closure_list);
grpc_call_stack_init (&exec_ctx, channel_stack, NULL, NULL, call_stack);
GPR_ASSERT (call_stack->count == 1);
call_elem = grpc_call_stack_element (call_stack, 0);
GPR_ASSERT (call_elem->filter == channel_elem->filter);
@ -136,11 +136,11 @@ test_create_channel_stack (void)
GPR_ASSERT (*call_data == 0);
GPR_ASSERT (*channel_data == 1);
grpc_call_stack_destroy (call_stack, &closure_list);
grpc_call_stack_destroy (&exec_ctx, call_stack);
gpr_free (call_stack);
GPR_ASSERT (*channel_data == 2);
grpc_channel_stack_destroy (channel_stack, &closure_list);
grpc_channel_stack_destroy (&exec_ctx, channel_stack);
gpr_free (channel_stack);
grpc_mdctx_unref (metadata_context);

@ -422,7 +422,7 @@ assert_channel_connectivity (grpc_channel * ch, size_t num_accepted_conn_states,
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 */ , &closure_list);
actual_conn_state = grpc_client_channel_check_connectivity_state (&exec_ctx, client_channel_filter, 0 /* don't try to connect */ );
grpc_exec_ctx_finish (&exec_ctx);
va_start (ap, accepted_conn_state);
for (i = 0; i < num_accepted_conn_states; i++)

@ -65,7 +65,7 @@ server_setup_transport (void *ts, grpc_transport * transport, grpc_mdctx * mdctx
&grpc_http_server_filter
};
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_server_setup_transport (f->server, transport, extra_filters, GPR_ARRAY_SIZE (extra_filters), mdctx, grpc_server_get_channel_args (f->server), &closure_list);
grpc_server_setup_transport (f->server, transport, extra_filters, GPR_ARRAY_SIZE (extra_filters), mdctx, grpc_server_get_channel_args (&exec_ctx, f->server));
grpc_exec_ctx_finish (&exec_ctx);
}
@ -118,10 +118,10 @@ chttp2_init_client_socketpair (grpc_end2end_test_fixture * f, grpc_channel_args
sp_client_setup cs;
cs.client_args = client_args;
cs.f = f;
transport = grpc_create_chttp2_transport (client_args, sfd->client, mdctx, 1, &closure_list);
client_setup_transport (&cs, transport, mdctx, &closure_list);
transport = grpc_create_chttp2_transport (&exec_ctx, client_args, sfd->client, mdctx, 1);
client_setup_transport (&exec_ctx, &cs, transport, mdctx);
GPR_ASSERT (f->client);
grpc_chttp2_transport_start_reading (transport, NULL, 0, &closure_list);
grpc_chttp2_transport_start_reading (&exec_ctx, transport, NULL, 0);
grpc_exec_ctx_finish (&exec_ctx);
}
@ -136,9 +136,9 @@ chttp2_init_server_socketpair (grpc_end2end_test_fixture * f, grpc_channel_args
f->server = grpc_server_create_from_filters (NULL, 0, server_args);
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, &closure_list);
transport = grpc_create_chttp2_transport (&exec_ctx, server_args, sfd->server, mdctx, 0);
server_setup_transport (f, transport, mdctx);
grpc_chttp2_transport_start_reading (transport, NULL, 0, &closure_list);
grpc_chttp2_transport_start_reading (&exec_ctx, transport, NULL, 0);
grpc_exec_ctx_finish (&exec_ctx);
}

@ -64,7 +64,7 @@ server_setup_transport (void *ts, grpc_transport * transport, grpc_mdctx * mdctx
&grpc_http_server_filter
};
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_server_setup_transport (f->server, transport, extra_filters, GPR_ARRAY_SIZE (extra_filters), mdctx, grpc_server_get_channel_args (f->server), &closure_list);
grpc_server_setup_transport (f->server, transport, extra_filters, GPR_ARRAY_SIZE (extra_filters), mdctx, grpc_server_get_channel_args (&exec_ctx, f->server));
grpc_exec_ctx_finish (&exec_ctx);
}
@ -117,10 +117,10 @@ chttp2_init_client_socketpair (grpc_end2end_test_fixture * f, grpc_channel_args
sp_client_setup cs;
cs.client_args = client_args;
cs.f = f;
transport = grpc_create_chttp2_transport (client_args, sfd->client, mdctx, 1, &closure_list);
client_setup_transport (&cs, transport, mdctx, &closure_list);
transport = grpc_create_chttp2_transport (&exec_ctx, client_args, sfd->client, mdctx, 1);
client_setup_transport (&exec_ctx, &cs, transport, mdctx);
GPR_ASSERT (f->client);
grpc_chttp2_transport_start_reading (transport, NULL, 0, &closure_list);
grpc_chttp2_transport_start_reading (&exec_ctx, transport, NULL, 0);
grpc_exec_ctx_finish (&exec_ctx);
}
@ -135,9 +135,9 @@ chttp2_init_server_socketpair (grpc_end2end_test_fixture * f, grpc_channel_args
f->server = grpc_server_create_from_filters (NULL, 0, server_args);
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, &closure_list);
transport = grpc_create_chttp2_transport (&exec_ctx, server_args, sfd->server, mdctx, 0);
server_setup_transport (f, transport, mdctx);
grpc_chttp2_transport_start_reading (transport, NULL, 0, &closure_list);
grpc_chttp2_transport_start_reading (&exec_ctx, transport, NULL, 0);
grpc_exec_ctx_finish (&exec_ctx);
}

@ -64,7 +64,7 @@ server_setup_transport (void *ts, grpc_transport * transport, grpc_mdctx * mdctx
&grpc_http_server_filter
};
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_server_setup_transport (f->server, transport, extra_filters, GPR_ARRAY_SIZE (extra_filters), mdctx, grpc_server_get_channel_args (f->server), &closure_list);
grpc_server_setup_transport (f->server, transport, extra_filters, GPR_ARRAY_SIZE (extra_filters), mdctx, grpc_server_get_channel_args (&exec_ctx, f->server));
grpc_exec_ctx_finish (&exec_ctx);
}
@ -117,10 +117,10 @@ chttp2_init_client_socketpair (grpc_end2end_test_fixture * f, grpc_channel_args
sp_client_setup cs;
cs.client_args = client_args;
cs.f = f;
transport = grpc_create_chttp2_transport (client_args, sfd->client, mdctx, 1, &closure_list);
client_setup_transport (&cs, transport, mdctx, &closure_list);
transport = grpc_create_chttp2_transport (&exec_ctx, client_args, sfd->client, mdctx, 1);
client_setup_transport (&exec_ctx, &cs, transport, mdctx);
GPR_ASSERT (f->client);
grpc_chttp2_transport_start_reading (transport, NULL, 0, &closure_list);
grpc_chttp2_transport_start_reading (&exec_ctx, transport, NULL, 0);
grpc_exec_ctx_finish (&exec_ctx);
}
@ -135,9 +135,9 @@ chttp2_init_server_socketpair (grpc_end2end_test_fixture * f, grpc_channel_args
f->server = grpc_server_create_from_filters (NULL, 0, server_args);
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, &closure_list);
transport = grpc_create_chttp2_transport (&exec_ctx, server_args, sfd->server, mdctx, 0);
server_setup_transport (f, transport, mdctx);
grpc_chttp2_transport_start_reading (transport, NULL, 0, &closure_list);
grpc_chttp2_transport_start_reading (&exec_ctx, transport, NULL, 0);
grpc_exec_ctx_finish (&exec_ctx);
}

@ -88,12 +88,12 @@ test_get (int use_ssl, int port)
req.path = "/get";
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, &closure_list);
grpc_httpcli_get (&g_context, &g_pollset, &req, n_seconds_time (15), on_finish, (&exec_ctx, void *) 42);
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), &closure_list);
grpc_pollset_work (&g_pollset, &worker, gpr_now (GPR_CLOCK_MONOTONIC), n_seconds_time (&exec_ctx, 20));
gpr_mu_unlock (GRPC_POLLSET_MU (&g_pollset));
grpc_exec_ctx_finish (&exec_ctx);
gpr_mu_lock (GRPC_POLLSET_MU (&g_pollset));
@ -120,12 +120,12 @@ test_post (int use_ssl, int port)
req.path = "/post";
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, &closure_list);
grpc_httpcli_post (&g_context, &g_pollset, &req, "hello", 5, n_seconds_time (15), on_finish, (&exec_ctx, void *) 42);
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), &closure_list);
grpc_pollset_work (&g_pollset, &worker, gpr_now (GPR_CLOCK_MONOTONIC), n_seconds_time (&exec_ctx, 20));
gpr_mu_unlock (GRPC_POLLSET_MU (&g_pollset));
grpc_exec_ctx_finish (&exec_ctx);
gpr_mu_lock (GRPC_POLLSET_MU (&g_pollset));
@ -184,7 +184,7 @@ 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, &closure_list);
grpc_pollset_shutdown (&exec_ctx, &g_pollset, &destroyed);
grpc_exec_ctx_finish (&exec_ctx);
grpc_shutdown ();

@ -63,17 +63,17 @@ add_test (void)
/* 10 ms alarms. will expire in the current epoch */
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, &closure_list);
grpc_alarm_init (&alarms[i], gpr_time_add (start, gpr_time_from_millis (10, GPR_TIMESPAN)), cb, (void *) (&exec_ctx, gpr_intptr) i, start);
}
/* 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, &closure_list);
grpc_alarm_init (&alarms[i], gpr_time_add (start, gpr_time_from_millis (1010, GPR_TIMESPAN)), cb, (void *) (&exec_ctx, gpr_intptr) i, start);
}
/* 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, &closure_list));
GPR_ASSERT (10 == grpc_alarm_check (gpr_time_add (start, gpr_time_from_millis (&exec_ctx, 500, GPR_TIMESPAN)), NULL));
grpc_exec_ctx_finish (&exec_ctx);
for (i = 0; i < 20; i++)
{
@ -81,7 +81,7 @@ add_test (void)
GPR_ASSERT (cb_called[i][0] == 0);
}
GPR_ASSERT (0 == grpc_alarm_check (gpr_time_add (start, gpr_time_from_millis (600, GPR_TIMESPAN)), NULL, &closure_list));
GPR_ASSERT (0 == grpc_alarm_check (gpr_time_add (start, gpr_time_from_millis (&exec_ctx, 600, GPR_TIMESPAN)), NULL));
grpc_exec_ctx_finish (&exec_ctx);
for (i = 0; i < 30; i++)
{
@ -90,7 +90,7 @@ add_test (void)
}
/* collect the rest of the alarms */
GPR_ASSERT (10 == grpc_alarm_check (gpr_time_add (start, gpr_time_from_millis (1500, GPR_TIMESPAN)), NULL, &closure_list));
GPR_ASSERT (10 == grpc_alarm_check (gpr_time_add (start, gpr_time_from_millis (&exec_ctx, 1500, GPR_TIMESPAN)), NULL));
grpc_exec_ctx_finish (&exec_ctx);
for (i = 0; i < 30; i++)
{
@ -98,7 +98,7 @@ add_test (void)
GPR_ASSERT (cb_called[i][0] == 0);
}
GPR_ASSERT (0 == grpc_alarm_check (gpr_time_add (start, gpr_time_from_millis (1600, GPR_TIMESPAN)), NULL, &closure_list));
GPR_ASSERT (0 == grpc_alarm_check (gpr_time_add (start, gpr_time_from_millis (&exec_ctx, 1600, GPR_TIMESPAN)), NULL));
for (i = 0; i < 30; i++)
{
GPR_ASSERT (cb_called[i][1] == (i < 20));
@ -127,16 +127,16 @@ destruction_test (void)
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), &closure_list);
grpc_alarm_init (&alarms[1], tfm (3), cb, (void *) (gpr_intptr) 1, 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), &closure_list);
grpc_alarm_init (&alarms[3], tfm (3), cb, (void *) (gpr_intptr) 3, 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), &closure_list);
GPR_ASSERT (1 == grpc_alarm_check (tfm (2), NULL, &closure_list));
grpc_alarm_init (&alarms[0], tfm (100), cb, (void *) (gpr_intptr) 0, gpr_time_0 (&exec_ctx, GPR_CLOCK_REALTIME));
grpc_alarm_init (&alarms[1], tfm (3), cb, (void *) (gpr_intptr) 1, gpr_time_0 (&exec_ctx, GPR_CLOCK_REALTIME));
grpc_alarm_init (&alarms[2], tfm (100), cb, (void *) (gpr_intptr) 2, gpr_time_0 (&exec_ctx, GPR_CLOCK_REALTIME));
grpc_alarm_init (&alarms[3], tfm (3), cb, (void *) (gpr_intptr) 3, gpr_time_0 (&exec_ctx, GPR_CLOCK_REALTIME));
grpc_alarm_init (&alarms[4], tfm (1), cb, (void *) (gpr_intptr) 4, gpr_time_0 (&exec_ctx, GPR_CLOCK_REALTIME));
GPR_ASSERT (1 == grpc_alarm_check (tfm (&exec_ctx, 2), NULL));
grpc_exec_ctx_finish (&exec_ctx);
GPR_ASSERT (1 == cb_called[4][1]);
grpc_alarm_cancel (&alarms[0], &closure_list);
grpc_alarm_cancel (&alarms[3], &closure_list);
grpc_alarm_cancel (&exec_ctx, &alarms[0]);
grpc_alarm_cancel (&exec_ctx, &alarms[3]);
grpc_exec_ctx_finish (&exec_ctx);
GPR_ASSERT (1 == cb_called[0][0]);
GPR_ASSERT (1 == cb_called[3][0]);

@ -58,8 +58,8 @@ create_fixture_endpoint_pair (size_t slice_size)
f.client_ep = p.client;
f.server_ep = p.server;
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_endpoint_add_to_pollset (&exec_ctx, f.client_ep, &g_pollset);
grpc_endpoint_add_to_pollset (&exec_ctx, f.server_ep, &g_pollset);
grpc_exec_ctx_finish (&exec_ctx);
return f;
@ -85,7 +85,7 @@ main (int argc, char **argv)
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, &closure_list);
grpc_pollset_shutdown (&exec_ctx, &g_pollset, &destroyed);
grpc_exec_ctx_finish (&exec_ctx);
grpc_shutdown ();

@ -231,17 +231,17 @@ read_and_write_test (grpc_endpoint_test_config config, size_t num_bytes, size_t
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, &closure_list);
read_and_write_test_write_handler (&exec_ctx, &state, 1);
grpc_exec_ctx_finish (&exec_ctx);
grpc_endpoint_read (state.read_ep, &state.incoming, &state.done_read, &closure_list);
grpc_endpoint_read (&exec_ctx, state.read_ep, &state.incoming, &state.done_read);
if (shutdown)
{
gpr_log (GPR_DEBUG, "shutdown read");
grpc_endpoint_shutdown (state.read_ep, &closure_list);
grpc_endpoint_shutdown (&exec_ctx, state.read_ep);
gpr_log (GPR_DEBUG, "shutdown write");
grpc_endpoint_shutdown (state.write_ep, &closure_list);
grpc_endpoint_shutdown (&exec_ctx, state.write_ep);
}
grpc_exec_ctx_finish (&exec_ctx);
@ -250,7 +250,7 @@ read_and_write_test (grpc_endpoint_test_config config, size_t num_bytes, size_t
{
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, &closure_list);
grpc_pollset_work (g_pollset, &worker, gpr_now (&exec_ctx, GPR_CLOCK_MONOTONIC), deadline);
}
gpr_mu_unlock (GRPC_POLLSET_MU (g_pollset));
grpc_exec_ctx_finish (&exec_ctx);
@ -258,8 +258,8 @@ read_and_write_test (grpc_endpoint_test_config config, size_t num_bytes, size_t
end_test (config);
gpr_slice_buffer_destroy (&state.outgoing);
gpr_slice_buffer_destroy (&state.incoming);
grpc_endpoint_destroy (state.read_ep, &closure_list);
grpc_endpoint_destroy (state.write_ep, &closure_list);
grpc_endpoint_destroy (&exec_ctx, state.read_ep);
grpc_endpoint_destroy (&exec_ctx, state.write_ep);
grpc_exec_ctx_finish (&exec_ctx);
}

@ -59,8 +59,8 @@ main (int argc, char **argv)
{
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
p = grpc_iomgr_create_endpoint_pair ("test", 1);
grpc_endpoint_destroy (p.client, &closure_list);
grpc_endpoint_destroy (p.server, &closure_list);
grpc_endpoint_destroy (&exec_ctx, p.client);
grpc_endpoint_destroy (&exec_ctx, p.server);
grpc_exec_ctx_finish (&exec_ctx);
}

@ -283,7 +283,7 @@ server_wait_and_shutdown (server * sv)
{
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_pollset_worker worker;
grpc_pollset_work (&g_pollset, &worker, gpr_now (GPR_CLOCK_MONOTONIC), gpr_inf_future (GPR_CLOCK_MONOTONIC), &closure_list);
grpc_pollset_work (&g_pollset, &worker, gpr_now (GPR_CLOCK_MONOTONIC), gpr_inf_future (&exec_ctx, GPR_CLOCK_MONOTONIC));
gpr_mu_unlock (GRPC_POLLSET_MU (&g_pollset));
grpc_exec_ctx_finish (&exec_ctx);
gpr_mu_lock (GRPC_POLLSET_MU (&g_pollset));
@ -423,7 +423,7 @@ client_wait_and_shutdown (client * cl)
{
grpc_pollset_worker worker;
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_pollset_work (&g_pollset, &worker, gpr_now (GPR_CLOCK_MONOTONIC), gpr_inf_future (GPR_CLOCK_MONOTONIC), &closure_list);
grpc_pollset_work (&g_pollset, &worker, gpr_now (GPR_CLOCK_MONOTONIC), gpr_inf_future (&exec_ctx, GPR_CLOCK_MONOTONIC));
gpr_mu_unlock (GRPC_POLLSET_MU (&g_pollset));
grpc_exec_ctx_finish (&exec_ctx);
gpr_mu_lock (GRPC_POLLSET_MU (&g_pollset));
@ -443,9 +443,9 @@ test_grpc_fd (void)
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
server_init (&sv);
port = server_start (&sv, &closure_list);
port = server_start (&exec_ctx, &sv);
client_init (&cl);
client_start (&cl, port, &closure_list);
client_start (&exec_ctx, &cl, port);
grpc_exec_ctx_finish (&exec_ctx);
client_wait_and_shutdown (&cl);
server_wait_and_shutdown (&sv);
@ -525,10 +525,10 @@ 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, &closure_list);
grpc_pollset_add_fd (&exec_ctx, &g_pollset, em_fd);
/* Register the first callback, then make its FD readable */
grpc_fd_notify_on_read (em_fd, &first_closure, &closure_list);
grpc_fd_notify_on_read (&exec_ctx, em_fd, &first_closure);
data = 0;
result = write (sv[1], &data, 1);
GPR_ASSERT (result == 1);
@ -538,7 +538,7 @@ 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), &closure_list);
grpc_pollset_work (&g_pollset, &worker, gpr_now (GPR_CLOCK_MONOTONIC), gpr_inf_future (&exec_ctx, GPR_CLOCK_MONOTONIC));
gpr_mu_unlock (GRPC_POLLSET_MU (&g_pollset));
grpc_exec_ctx_finish (&exec_ctx);
gpr_mu_lock (GRPC_POLLSET_MU (&g_pollset));
@ -552,7 +552,7 @@ 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, &closure_list);
grpc_fd_notify_on_read (&exec_ctx, em_fd, &second_closure);
data = 0;
result = write (sv[1], &data, 1);
GPR_ASSERT (result == 1);
@ -561,7 +561,7 @@ 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), &closure_list);
grpc_pollset_work (&g_pollset, &worker, gpr_now (GPR_CLOCK_MONOTONIC), gpr_inf_future (&exec_ctx, GPR_CLOCK_MONOTONIC));
gpr_mu_unlock (GRPC_POLLSET_MU (&g_pollset));
grpc_exec_ctx_finish (&exec_ctx);
gpr_mu_lock (GRPC_POLLSET_MU (&g_pollset));
@ -570,7 +570,7 @@ test_grpc_fd_change (void)
GPR_ASSERT (b.cb_that_ran == second_read_callback);
gpr_mu_unlock (GRPC_POLLSET_MU (&g_pollset));
grpc_fd_orphan (em_fd, NULL, "d", &closure_list);
grpc_fd_orphan (&exec_ctx, em_fd, NULL, "d");
grpc_exec_ctx_finish (&exec_ctx);
destroy_change_data (&a);
destroy_change_data (&b);
@ -594,7 +594,7 @@ main (int argc, char **argv)
test_grpc_fd ();
test_grpc_fd_change ();
grpc_closure_init (&destroyed, destroy_pollset, &g_pollset);
grpc_pollset_shutdown (&g_pollset, &destroyed, &closure_list);
grpc_pollset_shutdown (&exec_ctx, &g_pollset, &destroyed);
grpc_exec_ctx_finish (&exec_ctx);
grpc_iomgr_shutdown ();
return 0;

@ -115,7 +115,7 @@ test_succeeds (void)
/* connect to it */
GPR_ASSERT (getsockname (svr_fd, (struct sockaddr *) &addr, &addr_len) == 0);
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), &closure_list);
grpc_tcp_client_connect (&done, &g_connecting, &g_pollset_set, (struct sockaddr *) &addr, addr_len, gpr_inf_future (&exec_ctx, GPR_CLOCK_REALTIME));
/* await the connection */
do
@ -132,7 +132,7 @@ 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), &closure_list);
grpc_pollset_work (&g_pollset, &worker, gpr_now (GPR_CLOCK_MONOTONIC), GRPC_TIMEOUT_SECONDS_TO_DEADLINE (&exec_ctx, 5));
gpr_mu_unlock (GRPC_POLLSET_MU (&g_pollset));
grpc_exec_ctx_finish (&exec_ctx);
gpr_mu_lock (GRPC_POLLSET_MU (&g_pollset));
@ -161,7 +161,7 @@ test_fails (void)
/* connect to a broken address */
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), &closure_list);
grpc_tcp_client_connect (&done, &g_connecting, &g_pollset_set, (struct sockaddr *) &addr, addr_len, gpr_inf_future (&exec_ctx, GPR_CLOCK_REALTIME));
gpr_mu_lock (GRPC_POLLSET_MU (&g_pollset));
@ -169,7 +169,7 @@ 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 (), &closure_list);
grpc_pollset_work (&g_pollset, &worker, gpr_now (GPR_CLOCK_MONOTONIC), test_deadline (&exec_ctx, ));
gpr_mu_unlock (GRPC_POLLSET_MU (&g_pollset));
grpc_exec_ctx_finish (&exec_ctx);
gpr_mu_lock (GRPC_POLLSET_MU (&g_pollset));
@ -229,7 +229,7 @@ test_times_out (void)
gpr_mu_unlock (GRPC_POLLSET_MU (&g_pollset));
grpc_closure_init (&done, must_fail, NULL);
grpc_tcp_client_connect (&done, &g_connecting, &g_pollset_set, (struct sockaddr *) &addr, addr_len, connect_deadline, &closure_list);
grpc_tcp_client_connect (&done, &g_connecting, &g_pollset_set, (&exec_ctx, struct sockaddr *) &addr, addr_len, connect_deadline);
/* Make sure the event doesn't trigger early */
gpr_mu_lock (GRPC_POLLSET_MU (&g_pollset));
@ -255,7 +255,7 @@ test_times_out (void)
{
GPR_ASSERT (g_connections_complete == connections_complete_before + is_after_deadline);
}
grpc_pollset_work (&g_pollset, &worker, gpr_now (GPR_CLOCK_MONOTONIC), GRPC_TIMEOUT_MILLIS_TO_DEADLINE (10), &closure_list);
grpc_pollset_work (&g_pollset, &worker, gpr_now (GPR_CLOCK_MONOTONIC), GRPC_TIMEOUT_MILLIS_TO_DEADLINE (&exec_ctx, 10));
gpr_mu_unlock (GRPC_POLLSET_MU (&g_pollset));
grpc_exec_ctx_finish (&exec_ctx);
gpr_mu_lock (GRPC_POLLSET_MU (&g_pollset));
@ -284,7 +284,7 @@ main (int argc, char **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, &closure_list);
grpc_pollset_set_add_pollset (&exec_ctx, &g_pollset_set, &g_pollset);
grpc_exec_ctx_finish (&exec_ctx);
test_succeeds ();
gpr_log (GPR_ERROR, "End of first test");
@ -292,7 +292,7 @@ main (int argc, char **argv)
test_times_out ();
grpc_pollset_set_destroy (&g_pollset_set);
grpc_closure_init (&destroyed, destroy_pollset, &g_pollset);
grpc_pollset_shutdown (&g_pollset, &destroyed, &closure_list);
grpc_pollset_shutdown (&exec_ctx, &g_pollset, &destroyed);
grpc_exec_ctx_finish (&exec_ctx);
grpc_shutdown ();
return 0;

@ -197,7 +197,7 @@ 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, &closure_list);
grpc_endpoint_add_to_pollset (&exec_ctx, ep, &g_pollset);
written_bytes = fill_socket_partial (sv[0], num_bytes);
gpr_log (GPR_INFO, "Wrote %d bytes", written_bytes);
@ -208,13 +208,13 @@ 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, &closure_list);
grpc_endpoint_read (&exec_ctx, ep, &state.incoming, &state.read_cb);
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, &closure_list);
grpc_pollset_work (&g_pollset, &worker, gpr_now (&exec_ctx, GPR_CLOCK_MONOTONIC), deadline);
gpr_mu_unlock (GRPC_POLLSET_MU (&g_pollset));
grpc_exec_ctx_finish (&exec_ctx);
gpr_mu_lock (GRPC_POLLSET_MU (&g_pollset));
@ -223,7 +223,7 @@ read_test (size_t num_bytes, size_t slice_size)
gpr_mu_unlock (GRPC_POLLSET_MU (&g_pollset));
gpr_slice_buffer_destroy (&state.incoming);
grpc_endpoint_destroy (ep, &closure_list);
grpc_endpoint_destroy (&exec_ctx, ep);
grpc_exec_ctx_finish (&exec_ctx);
}
@ -244,7 +244,7 @@ large_read_test (size_t slice_size)
create_sockets (sv);
ep = grpc_tcp_create (grpc_fd_create (sv[1], "large_read_test"), slice_size, "test");
grpc_endpoint_add_to_pollset (ep, &g_pollset, &closure_list);
grpc_endpoint_add_to_pollset (&exec_ctx, ep, &g_pollset);
written_bytes = fill_socket (sv[0]);
gpr_log (GPR_INFO, "Wrote %d bytes", written_bytes);
@ -255,13 +255,13 @@ 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, &closure_list);
grpc_endpoint_read (&exec_ctx, ep, &state.incoming, &state.read_cb);
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, &closure_list);
grpc_pollset_work (&g_pollset, &worker, gpr_now (&exec_ctx, GPR_CLOCK_MONOTONIC), deadline);
gpr_mu_unlock (GRPC_POLLSET_MU (&g_pollset));
grpc_exec_ctx_finish (&exec_ctx);
gpr_mu_lock (GRPC_POLLSET_MU (&g_pollset));
@ -270,7 +270,7 @@ large_read_test (size_t slice_size)
gpr_mu_unlock (GRPC_POLLSET_MU (&g_pollset));
gpr_slice_buffer_destroy (&state.incoming);
grpc_endpoint_destroy (ep, &closure_list);
grpc_endpoint_destroy (&exec_ctx, ep);
grpc_exec_ctx_finish (&exec_ctx);
}
@ -336,7 +336,7 @@ 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), &closure_list);
grpc_pollset_work (&g_pollset, &worker, gpr_now (GPR_CLOCK_MONOTONIC), GRPC_TIMEOUT_MILLIS_TO_DEADLINE (&exec_ctx, 10));
gpr_mu_unlock (GRPC_POLLSET_MU (&g_pollset));
grpc_exec_ctx_finish (&exec_ctx);
do
@ -382,7 +382,7 @@ write_test (size_t num_bytes, size_t slice_size)
create_sockets (sv);
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, &closure_list);
grpc_endpoint_add_to_pollset (&exec_ctx, ep, &g_pollset);
state.ep = ep;
state.write_done = 0;
@ -393,7 +393,7 @@ 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, &closure_list);
grpc_endpoint_write (&exec_ctx, ep, &outgoing, &write_done_closure);
drain_socket_blocking (sv[0], num_bytes, num_bytes);
gpr_mu_lock (GRPC_POLLSET_MU (&g_pollset));
for (;;)
@ -403,7 +403,7 @@ write_test (size_t num_bytes, size_t slice_size)
{
break;
}
grpc_pollset_work (&g_pollset, &worker, gpr_now (GPR_CLOCK_MONOTONIC), deadline, &closure_list);
grpc_pollset_work (&g_pollset, &worker, gpr_now (&exec_ctx, GPR_CLOCK_MONOTONIC), deadline);
gpr_mu_unlock (GRPC_POLLSET_MU (&g_pollset));
grpc_exec_ctx_finish (&exec_ctx);
gpr_mu_lock (GRPC_POLLSET_MU (&g_pollset));
@ -411,7 +411,7 @@ write_test (size_t num_bytes, size_t slice_size)
gpr_mu_unlock (GRPC_POLLSET_MU (&g_pollset));
gpr_slice_buffer_destroy (&outgoing);
grpc_endpoint_destroy (ep, &closure_list);
grpc_endpoint_destroy (&exec_ctx, ep);
gpr_free (slices);
grpc_exec_ctx_finish (&exec_ctx);
}
@ -455,8 +455,8 @@ create_fixture_tcp_socketpair (size_t slice_size)
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, &closure_list);
grpc_endpoint_add_to_pollset (f.server_ep, &g_pollset, &closure_list);
grpc_endpoint_add_to_pollset (&exec_ctx, f.client_ep, &g_pollset);
grpc_endpoint_add_to_pollset (&exec_ctx, f.server_ep, &g_pollset);
grpc_exec_ctx_finish (&exec_ctx);
@ -484,7 +484,7 @@ main (int argc, char **argv)
run_tests ();
grpc_endpoint_tests (configs[0], &g_pollset);
grpc_closure_init (&destroyed, destroy_pollset, &g_pollset);
grpc_pollset_shutdown (&g_pollset, &destroyed, &closure_list);
grpc_pollset_shutdown (&exec_ctx, &g_pollset, &destroyed);
grpc_exec_ctx_finish (&exec_ctx);
grpc_shutdown ();

@ -73,7 +73,7 @@ test_no_op_with_start (void)
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_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, &closure_list);
grpc_tcp_server_start (&exec_ctx, s, NULL, 0, on_connect, NULL);
grpc_tcp_server_destroy (s, NULL, NULL);
grpc_exec_ctx_finish (&exec_ctx);
}
@ -90,7 +90,7 @@ test_no_op_with_port (void)
addr.sin_family = AF_INET;
GPR_ASSERT (grpc_tcp_server_add_port (s, (struct sockaddr *) &addr, sizeof (addr)));
grpc_tcp_server_destroy (s, NULL, &closure_list);
grpc_tcp_server_destroy (&exec_ctx, s, NULL);
grpc_exec_ctx_finish (&exec_ctx);
}
@ -106,9 +106,9 @@ test_no_op_with_port_and_start (void)
addr.sin_family = AF_INET;
GPR_ASSERT (grpc_tcp_server_add_port (s, (struct sockaddr *) &addr, sizeof (addr)));
grpc_tcp_server_start (s, NULL, 0, on_connect, NULL, &closure_list);
grpc_tcp_server_start (&exec_ctx, s, NULL, 0, on_connect, NULL);
grpc_tcp_server_destroy (s, NULL, &closure_list);
grpc_tcp_server_destroy (&exec_ctx, s, NULL);
grpc_exec_ctx_finish (&exec_ctx);
}
@ -137,7 +137,7 @@ test_connect (int n)
GPR_ASSERT (addr_len <= sizeof (addr));
pollsets[0] = &g_pollset;
grpc_tcp_server_start (s, pollsets, 1, on_connect, NULL, &closure_list);
grpc_tcp_server_start (&exec_ctx, s, pollsets, 1, on_connect, NULL);
gpr_mu_lock (GRPC_POLLSET_MU (&g_pollset));
@ -155,7 +155,7 @@ test_connect (int n)
while (g_nconnects == nconnects_before && 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, &closure_list);
grpc_pollset_work (&g_pollset, &worker, gpr_now (&exec_ctx, GPR_CLOCK_MONOTONIC), deadline);
gpr_mu_unlock (GRPC_POLLSET_MU (&g_pollset));
grpc_exec_ctx_finish (&exec_ctx);
gpr_mu_lock (GRPC_POLLSET_MU (&g_pollset));
@ -168,7 +168,7 @@ test_connect (int n)
gpr_mu_unlock (GRPC_POLLSET_MU (&g_pollset));
grpc_tcp_server_destroy (s, NULL, &closure_list);
grpc_tcp_server_destroy (&exec_ctx, s, NULL);
grpc_exec_ctx_finish (&exec_ctx);
}
@ -195,7 +195,7 @@ main (int argc, char **argv)
test_connect (10);
grpc_closure_init (&destroyed, destroy_pollset, &g_pollset);
grpc_pollset_shutdown (&g_pollset, &destroyed, &closure_list);
grpc_pollset_shutdown (&exec_ctx, &g_pollset, &destroyed);
grpc_exec_ctx_finish (&exec_ctx);
grpc_iomgr_shutdown ();
return 0;

@ -78,7 +78,7 @@ test_no_op_with_start (void)
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_udp_server *s = grpc_udp_server_create ();
LOG_TEST ("test_no_op_with_start");
grpc_udp_server_start (s, NULL, 0, &closure_list);
grpc_udp_server_start (&exec_ctx, s, NULL, 0);
grpc_udp_server_destroy (s, NULL, NULL);
grpc_exec_ctx_finish (&exec_ctx);
}
@ -109,9 +109,9 @@ test_no_op_with_port_and_start (void)
addr.sin_family = AF_INET;
GPR_ASSERT (grpc_udp_server_add_port (s, (struct sockaddr *) &addr, sizeof (addr), on_read));
grpc_udp_server_start (s, NULL, 0, &closure_list);
grpc_udp_server_start (&exec_ctx, s, NULL, 0);
grpc_udp_server_destroy (s, NULL, &closure_list);
grpc_udp_server_destroy (&exec_ctx, s, NULL);
grpc_exec_ctx_finish (&exec_ctx);
}
@ -142,7 +142,7 @@ test_receive (int number_of_clients)
GPR_ASSERT (addr_len <= sizeof (addr));
pollsets[0] = &g_pollset;
grpc_udp_server_start (s, pollsets, 1, &closure_list);
grpc_udp_server_start (&exec_ctx, s, pollsets, 1);
gpr_mu_lock (GRPC_POLLSET_MU (&g_pollset));
@ -159,7 +159,7 @@ test_receive (int number_of_clients)
while (g_number_of_reads == number_of_reads_before && 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, &closure_list);
grpc_pollset_work (&g_pollset, &worker, gpr_now (&exec_ctx, GPR_CLOCK_MONOTONIC), deadline);
gpr_mu_unlock (GRPC_POLLSET_MU (&g_pollset));
grpc_exec_ctx_finish (&exec_ctx);
gpr_mu_lock (GRPC_POLLSET_MU (&g_pollset));
@ -197,7 +197,7 @@ main (int argc, char **argv)
test_receive (10);
grpc_closure_init (&destroyed, destroy_pollset, &g_pollset);
grpc_pollset_shutdown (&g_pollset, &destroyed, &closure_list);
grpc_pollset_shutdown (&exec_ctx, &g_pollset, &destroyed);
grpc_exec_ctx_finish (&exec_ctx);
grpc_iomgr_shutdown ();
return 0;

@ -62,16 +62,16 @@ test_add_closure (void)
grpc_closure_init (&c, must_succeed, &done);
grpc_workqueue_push (wq, &c, 1);
grpc_workqueue_add_to_pollset (wq, &g_pollset, &closure_list);
grpc_workqueue_add_to_pollset (&exec_ctx, wq, &g_pollset);
gpr_mu_lock (GRPC_POLLSET_MU (&g_pollset));
GPR_ASSERT (!done);
grpc_pollset_work (&g_pollset, &worker, gpr_now (deadline.clock_type), deadline, &closure_list);
grpc_pollset_work (&g_pollset, &worker, gpr_now (&exec_ctx, deadline.clock_type), deadline);
gpr_mu_unlock (GRPC_POLLSET_MU (&g_pollset));
grpc_exec_ctx_finish (&exec_ctx);
GPR_ASSERT (done);
GRPC_WORKQUEUE_UNREF (wq, "destroy", &closure_list);
GRPC_WORKQUEUE_UNREF (&exec_ctx, wq, "destroy");
grpc_exec_ctx_finish (&exec_ctx);
}
@ -93,7 +93,7 @@ main (int argc, char **argv)
test_add_closure ();
grpc_closure_init (&destroyed, destroy_pollset, &g_pollset);
grpc_pollset_shutdown (&g_pollset, &destroyed, &closure_list);
grpc_pollset_shutdown (&exec_ctx, &g_pollset, &destroyed);
grpc_exec_ctx_finish (&exec_ctx);
grpc_shutdown ();
return 0;

@ -308,7 +308,7 @@ test_google_iam_creds (void)
NULL);
GPR_ASSERT (grpc_credentials_has_request_metadata (creds));
GPR_ASSERT (grpc_credentials_has_request_metadata_only (creds));
grpc_credentials_get_request_metadata (creds, NULL, test_service_url, check_google_iam_metadata, creds, &closure_list);
grpc_credentials_get_request_metadata (&exec_ctx, creds, NULL, test_service_url, check_google_iam_metadata, creds);
grpc_exec_ctx_finish (&exec_ctx);
}
@ -331,7 +331,7 @@ test_access_token_creds (void)
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, &closure_list);
grpc_credentials_get_request_metadata (&exec_ctx, creds, NULL, test_service_url, check_access_token_metadata, creds);
grpc_exec_ctx_finish (&exec_ctx);
}
@ -365,7 +365,7 @@ test_ssl_oauth2_composite_creds (void)
GPR_ASSERT (creds_array->num_creds == 2);
GPR_ASSERT (strcmp (creds_array->creds_array[0]->type, GRPC_CREDENTIALS_TYPE_SSL) == 0);
GPR_ASSERT (strcmp (creds_array->creds_array[1]->type, GRPC_CREDENTIALS_TYPE_OAUTH2) == 0);
grpc_credentials_get_request_metadata (composite_creds, NULL, test_service_url, check_ssl_oauth2_composite_metadata, composite_creds, &closure_list);
grpc_credentials_get_request_metadata (&exec_ctx, composite_creds, NULL, test_service_url, check_ssl_oauth2_composite_metadata, composite_creds);
grpc_exec_ctx_finish (&exec_ctx);
}
@ -421,7 +421,7 @@ test_ssl_oauth2_google_iam_composite_creds (void)
GPR_ASSERT (strcmp (creds_array->creds_array[0]->type, GRPC_CREDENTIALS_TYPE_SSL) == 0);
GPR_ASSERT (strcmp (creds_array->creds_array[1]->type, GRPC_CREDENTIALS_TYPE_OAUTH2) == 0);
GPR_ASSERT (strcmp (creds_array->creds_array[2]->type, GRPC_CREDENTIALS_TYPE_IAM) == 0);
grpc_credentials_get_request_metadata (composite_creds, NULL, test_service_url, check_ssl_oauth2_google_iam_composite_metadata, composite_creds, &closure_list);
grpc_credentials_get_request_metadata (&exec_ctx, composite_creds, NULL, test_service_url, check_ssl_oauth2_google_iam_composite_metadata, composite_creds);
grpc_exec_ctx_finish (&exec_ctx);
}
@ -498,12 +498,12 @@ 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, &closure_list);
grpc_credentials_get_request_metadata (compute_engine_creds, NULL, test_service_url, on_oauth2_creds_get_metadata_success, (&exec_ctx, void *) test_user_data);
grpc_exec_ctx_finish (&exec_ctx);
/* 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, &closure_list);
grpc_credentials_get_request_metadata (compute_engine_creds, NULL, test_service_url, on_oauth2_creds_get_metadata_success, (&exec_ctx, void *) test_user_data);
grpc_exec_ctx_finish (&exec_ctx);
grpc_credentials_unref (compute_engine_creds);
@ -518,7 +518,7 @@ test_compute_engine_creds_failure (void)
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, &closure_list);
grpc_credentials_get_request_metadata (compute_engine_creds, NULL, test_service_url, on_oauth2_creds_get_metadata_failure, (&exec_ctx, void *) test_user_data);
grpc_credentials_unref (compute_engine_creds);
grpc_httpcli_set_override (NULL, NULL);
grpc_exec_ctx_finish (&exec_ctx);
@ -572,12 +572,12 @@ 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, &closure_list);
grpc_credentials_get_request_metadata (refresh_token_creds, NULL, test_service_url, on_oauth2_creds_get_metadata_success, (&exec_ctx, void *) test_user_data);
grpc_exec_ctx_finish (&exec_ctx);
/* 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, &closure_list);
grpc_credentials_get_request_metadata (refresh_token_creds, NULL, test_service_url, on_oauth2_creds_get_metadata_success, (&exec_ctx, void *) test_user_data);
grpc_exec_ctx_finish (&exec_ctx);
grpc_credentials_unref (refresh_token_creds);
@ -594,7 +594,7 @@ test_refresh_token_creds_failure (void)
grpc_httpcli_set_override (httpcli_get_should_not_be_called, 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, &closure_list);
grpc_credentials_get_request_metadata (refresh_token_creds, NULL, test_service_url, on_oauth2_creds_get_metadata_failure, (&exec_ctx, void *) test_user_data);
grpc_credentials_unref (refresh_token_creds);
grpc_httpcli_set_override (NULL, NULL);
grpc_exec_ctx_finish (&exec_ctx);
@ -669,18 +669,18 @@ test_jwt_creds_success (void)
/* First request: jwt_encode_and_sign should be called. */
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, &closure_list);
grpc_credentials_get_request_metadata (jwt_creds, NULL, test_service_url, on_jwt_creds_get_metadata_success, (&exec_ctx, void *) test_user_data);
grpc_exec_ctx_finish (&exec_ctx);
/* 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, &closure_list);
grpc_credentials_get_request_metadata (jwt_creds, NULL, test_service_url, on_jwt_creds_get_metadata_success, (&exec_ctx, void *) test_user_data);
grpc_exec_ctx_finish (&exec_ctx);
/* 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, &closure_list);
grpc_credentials_get_request_metadata (jwt_creds, NULL, other_test_service_url, on_jwt_creds_get_metadata_success, (&exec_ctx, void *) test_user_data);
grpc_exec_ctx_finish (&exec_ctx);
gpr_free (json_key_string);
@ -698,7 +698,7 @@ test_jwt_creds_signing_failure (void)
GPR_ASSERT (grpc_credentials_has_request_metadata_only (jwt_creds));
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, &closure_list);
grpc_credentials_get_request_metadata (jwt_creds, NULL, test_service_url, on_jwt_creds_get_metadata_failure, (&exec_ctx, void *) test_user_data);
gpr_free (json_key_string);
grpc_credentials_unref (jwt_creds);
@ -854,7 +854,7 @@ test_metadata_plugin_success (void)
creds = grpc_metadata_credentials_create_from_plugin (plugin, NULL);
GPR_ASSERT (state == PLUGIN_INITIAL_STATE);
grpc_credentials_get_request_metadata (creds, NULL, test_service_url, on_plugin_metadata_received_success, NULL, &closure_list);
grpc_credentials_get_request_metadata (&exec_ctx, creds, NULL, test_service_url, on_plugin_metadata_received_success, NULL);
GPR_ASSERT (state == PLUGIN_GET_METADATA_CALLED_STATE);
grpc_credentials_release (creds);
GPR_ASSERT (state == PLUGIN_DESTROY_CALLED_STATE);
@ -875,7 +875,7 @@ test_metadata_plugin_failure (void)
creds = grpc_metadata_credentials_create_from_plugin (plugin, NULL);
GPR_ASSERT (state == PLUGIN_INITIAL_STATE);
grpc_credentials_get_request_metadata (creds, NULL, test_service_url, on_plugin_metadata_received_failure, NULL, &closure_list);
grpc_credentials_get_request_metadata (&exec_ctx, creds, NULL, test_service_url, on_plugin_metadata_received_failure, NULL);
GPR_ASSERT (state == PLUGIN_GET_METADATA_CALLED_STATE);
grpc_credentials_release (creds);
GPR_ASSERT (state == PLUGIN_DESTROY_CALLED_STATE);

@ -232,7 +232,7 @@ test_jwt_verifier_google_email_issuer_success (void)
jwt = grpc_jwt_encode_and_sign (&key, expected_audience, expected_lifetime, NULL);
grpc_auth_json_key_destruct (&key);
GPR_ASSERT (jwt != NULL);
grpc_jwt_verifier_verify (verifier, NULL, jwt, expected_audience, on_verification_success, (void *) expected_user_data, &closure_list);
grpc_jwt_verifier_verify (verifier, NULL, jwt, expected_audience, on_verification_success, (&exec_ctx, void *) expected_user_data);
gpr_free (jwt);
grpc_jwt_verifier_destroy (verifier);
grpc_httpcli_set_override (NULL, NULL);
@ -265,7 +265,7 @@ test_jwt_verifier_custom_email_issuer_success (void)
jwt = grpc_jwt_encode_and_sign (&key, expected_audience, expected_lifetime, NULL);
grpc_auth_json_key_destruct (&key);
GPR_ASSERT (jwt != NULL);
grpc_jwt_verifier_verify (verifier, NULL, jwt, expected_audience, on_verification_success, (void *) expected_user_data, &closure_list);
grpc_jwt_verifier_verify (verifier, NULL, jwt, expected_audience, on_verification_success, (&exec_ctx, void *) expected_user_data);
gpr_free (jwt);
grpc_jwt_verifier_destroy (verifier);
grpc_httpcli_set_override (NULL, NULL);
@ -311,7 +311,7 @@ test_jwt_verifier_url_issuer_success (void)
jwt = grpc_jwt_encode_and_sign (&key, expected_audience, expected_lifetime, NULL);
grpc_auth_json_key_destruct (&key);
GPR_ASSERT (jwt != NULL);
grpc_jwt_verifier_verify (verifier, NULL, jwt, expected_audience, on_verification_success, (void *) expected_user_data, &closure_list);
grpc_jwt_verifier_verify (verifier, NULL, jwt, expected_audience, on_verification_success, (&exec_ctx, void *) expected_user_data);
gpr_free (jwt);
grpc_jwt_verifier_destroy (verifier);
grpc_httpcli_set_override (NULL, NULL);
@ -350,7 +350,7 @@ test_jwt_verifier_url_issuer_bad_config (void)
jwt = grpc_jwt_encode_and_sign (&key, expected_audience, expected_lifetime, NULL);
grpc_auth_json_key_destruct (&key);
GPR_ASSERT (jwt != NULL);
grpc_jwt_verifier_verify (verifier, NULL, jwt, expected_audience, on_verification_key_retrieval_error, (void *) expected_user_data, &closure_list);
grpc_jwt_verifier_verify (verifier, NULL, jwt, expected_audience, on_verification_key_retrieval_error, (&exec_ctx, void *) expected_user_data);
gpr_free (jwt);
grpc_jwt_verifier_destroy (verifier);
grpc_httpcli_set_override (NULL, NULL);
@ -371,7 +371,7 @@ test_jwt_verifier_bad_json_key (void)
jwt = grpc_jwt_encode_and_sign (&key, expected_audience, expected_lifetime, NULL);
grpc_auth_json_key_destruct (&key);
GPR_ASSERT (jwt != NULL);
grpc_jwt_verifier_verify (verifier, NULL, jwt, expected_audience, on_verification_key_retrieval_error, (void *) expected_user_data, &closure_list);
grpc_jwt_verifier_verify (verifier, NULL, jwt, expected_audience, on_verification_key_retrieval_error, (&exec_ctx, void *) expected_user_data);
gpr_free (jwt);
grpc_jwt_verifier_destroy (verifier);
grpc_httpcli_set_override (NULL, NULL);
@ -419,7 +419,7 @@ test_jwt_verifier_bad_signature (void)
grpc_auth_json_key_destruct (&key);
corrupt_jwt_sig (jwt);
GPR_ASSERT (jwt != NULL);
grpc_jwt_verifier_verify (verifier, NULL, jwt, expected_audience, on_verification_bad_signature, (void *) expected_user_data, &closure_list);
grpc_jwt_verifier_verify (verifier, NULL, jwt, expected_audience, on_verification_bad_signature, (&exec_ctx, void *) expected_user_data);
gpr_free (jwt);
grpc_jwt_verifier_destroy (verifier);
grpc_httpcli_set_override (NULL, NULL);
@ -447,7 +447,7 @@ test_jwt_verifier_bad_format (void)
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_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, &closure_list);
grpc_jwt_verifier_verify (verifier, NULL, "bad jwt", expected_audience, on_verification_bad_format, (&exec_ctx, void *) expected_user_data);
grpc_jwt_verifier_destroy (verifier);
grpc_httpcli_set_override (NULL, NULL);
grpc_exec_ctx_finish (&exec_ctx);

@ -92,7 +92,7 @@ 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, &closure_list);
grpc_credentials_get_request_metadata (&exec_ctx, creds, &request.pollset, "", on_oauth2_response, &request);
grpc_exec_ctx_finish (&exec_ctx);
@ -100,11 +100,11 @@ grpc_test_fetch_oauth2_token_with_credentials (grpc_credentials * creds)
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), &closure_list);
grpc_pollset_work (&request.pollset, &worker, gpr_now (GPR_CLOCK_MONOTONIC), gpr_inf_future (&exec_ctx, GPR_CLOCK_MONOTONIC));
}
gpr_mu_unlock (GRPC_POLLSET_MU (&request.pollset));
grpc_pollset_shutdown (&request.pollset, &do_nothing_closure, &closure_list);
grpc_pollset_shutdown (&exec_ctx, &request.pollset, &do_nothing_closure);
grpc_exec_ctx_finish (&exec_ctx);
grpc_pollset_destroy (&request.pollset);
return request.token;

@ -97,13 +97,13 @@ main (int argc, char **argv)
grpc_pollset_init (&sync.pollset);
sync.is_done = 0;
grpc_credentials_get_request_metadata (creds, &sync.pollset, service_url, on_metadata_response, &sync, &closure_list);
grpc_credentials_get_request_metadata (&exec_ctx, creds, &sync.pollset, service_url, on_metadata_response, &sync);
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), &closure_list);
grpc_pollset_work (&sync.pollset, &worker, gpr_now (GPR_CLOCK_MONOTONIC), gpr_inf_future (&exec_ctx, GPR_CLOCK_MONOTONIC));
gpr_mu_unlock (GRPC_POLLSET_MU (&sync.pollset));
grpc_exec_ctx_finish (&exec_ctx);
gpr_mu_lock (GRPC_POLLSET_MU (&sync.pollset));

@ -57,8 +57,8 @@ secure_endpoint_create_fixture_tcp_socketpair (size_t slice_size, gpr_slice * le
grpc_endpoint_pair tcp;
tcp = grpc_iomgr_create_endpoint_pair ("fixture", slice_size);
grpc_endpoint_add_to_pollset (tcp.client, &g_pollset, &closure_list);
grpc_endpoint_add_to_pollset (tcp.server, &g_pollset, &closure_list);
grpc_endpoint_add_to_pollset (&exec_ctx, tcp.client, &g_pollset);
grpc_endpoint_add_to_pollset (&exec_ctx, tcp.server, &g_pollset);
if (leftover_nslices == 0)
{
@ -161,16 +161,16 @@ test_leftover (grpc_endpoint_test_config config, size_t slice_size)
gpr_slice_buffer_init (&incoming);
grpc_closure_init (&done_closure, inc_call_ctr, &n);
grpc_endpoint_read (f.client_ep, &incoming, &done_closure, &closure_list);
grpc_endpoint_read (&exec_ctx, f.client_ep, &incoming, &done_closure);
grpc_exec_ctx_finish (&exec_ctx);
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, &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_endpoint_shutdown (&exec_ctx, f.client_ep);
grpc_endpoint_shutdown (&exec_ctx, f.server_ep);
grpc_endpoint_destroy (&exec_ctx, f.client_ep);
grpc_endpoint_destroy (&exec_ctx, f.server_ep);
grpc_exec_ctx_finish (&exec_ctx);
gpr_slice_unref (s);
gpr_slice_buffer_destroy (&incoming);
@ -196,7 +196,7 @@ 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, &closure_list);
grpc_pollset_shutdown (&exec_ctx, &g_pollset, &destroyed);
grpc_exec_ctx_finish (&exec_ctx);
grpc_shutdown ();

@ -113,13 +113,13 @@ main (int argc, char **argv)
grpc_pollset_init (&sync.pollset);
sync.is_done = 0;
grpc_jwt_verifier_verify (verifier, &sync.pollset, jwt, aud, on_jwt_verification_done, &sync, &closure_list);
grpc_jwt_verifier_verify (&exec_ctx, verifier, &sync.pollset, jwt, aud, on_jwt_verification_done, &sync);
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), &closure_list);
grpc_pollset_work (&sync.pollset, &worker, gpr_now (GPR_CLOCK_MONOTONIC), gpr_inf_future (&exec_ctx, GPR_CLOCK_MONOTONIC));
gpr_mu_unlock (GRPC_POLLSET_MU (&sync.pollset));
grpc_exec_ctx_finish (&exec_ctx);
gpr_mu_lock (GRPC_POLLSET_MU (&sync.pollset));

@ -102,7 +102,7 @@ test_cq_end_op (void)
cc = grpc_completion_queue_create (NULL);
grpc_cq_begin_op (cc);
grpc_cq_end_op (cc, tag, 1, do_nothing_end_completion, NULL, &completion, &closure_list);
grpc_cq_end_op (&exec_ctx, cc, tag, 1, do_nothing_end_completion, NULL, &completion);
ev = grpc_completion_queue_next (cc, gpr_inf_past (GPR_CLOCK_REALTIME), NULL);
GPR_ASSERT (ev.type == GRPC_OP_COMPLETE);
@ -167,7 +167,7 @@ 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], &closure_list);
grpc_cq_end_op (&exec_ctx, cc, tags[i], 1, do_nothing_end_completion, NULL, &completions[i]);
}
for (i = 0; i < GPR_ARRAY_SIZE (tags); i++)
@ -179,7 +179,7 @@ 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], &closure_list);
grpc_cq_end_op (&exec_ctx, cc, tags[i], 1, do_nothing_end_completion, NULL, &completions[i]);
}
for (i = 0; i < GPR_ARRAY_SIZE (tags); i++)
@ -242,7 +242,7 @@ 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)), &closure_list);
grpc_cq_end_op (opt->cc, (void *) (gpr_intptr) 1, 1, free_completion, NULL, gpr_malloc (sizeof (&exec_ctx, grpc_cq_completion)));
opt->events_triggered++;
grpc_exec_ctx_finish (&exec_ctx);
}

@ -116,18 +116,18 @@ free_port_using_server (char *server, int port)
req.path = path;
grpc_httpcli_context_init (&context);
grpc_httpcli_get (&context, &pr.pollset, &req, GRPC_TIMEOUT_SECONDS_TO_DEADLINE (10), freed_port_from_server, &pr, &closure_list);
grpc_httpcli_get (&context, &pr.pollset, &req, GRPC_TIMEOUT_SECONDS_TO_DEADLINE (&exec_ctx, 10), freed_port_from_server, &pr);
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), &closure_list);
grpc_pollset_work (&pr.pollset, &worker, gpr_now (GPR_CLOCK_MONOTONIC), GRPC_TIMEOUT_SECONDS_TO_DEADLINE (&exec_ctx, 1));
}
gpr_mu_unlock (GRPC_POLLSET_MU (&pr.pollset));
grpc_httpcli_context_destroy (&context);
grpc_exec_ctx_finish (&exec_ctx);
grpc_pollset_shutdown (&pr.pollset, &shutdown_closure, &closure_list);
grpc_pollset_shutdown (&exec_ctx, &pr.pollset, &shutdown_closure);
grpc_exec_ctx_finish (&exec_ctx);
gpr_free (path);
}
@ -287,18 +287,18 @@ pick_port_using_server (char *server)
req.path = "/get";
grpc_httpcli_context_init (&context);
grpc_httpcli_get (&context, &pr.pollset, &req, GRPC_TIMEOUT_SECONDS_TO_DEADLINE (10), got_port_from_server, &pr, &closure_list);
grpc_httpcli_get (&context, &pr.pollset, &req, GRPC_TIMEOUT_SECONDS_TO_DEADLINE (&exec_ctx, 10), got_port_from_server, &pr);
grpc_exec_ctx_finish (&exec_ctx);
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), &closure_list);
grpc_pollset_work (&pr.pollset, &worker, gpr_now (GPR_CLOCK_MONOTONIC), GRPC_TIMEOUT_SECONDS_TO_DEADLINE (&exec_ctx, 1));
}
gpr_mu_unlock (GRPC_POLLSET_MU (&pr.pollset));
grpc_httpcli_context_destroy (&context);
grpc_pollset_shutdown (&pr.pollset, &shutdown_closure, &closure_list);
grpc_pollset_shutdown (&exec_ctx, &pr.pollset, &shutdown_closure);
grpc_exec_ctx_finish (&exec_ctx);
return pr.port;

@ -140,7 +140,7 @@ reconnect_server_start (reconnect_server * server, int port)
port_added = grpc_tcp_server_add_port (server->tcp_server, &addr, sizeof (addr));
GPR_ASSERT (port_added == port);
grpc_tcp_server_start (server->tcp_server, server->pollsets, 1, on_connect, server, &closure_list);
grpc_tcp_server_start (&exec_ctx, server->tcp_server, server->pollsets, 1, on_connect, server);
gpr_log (GPR_INFO, "reconnect tcp server listening on 0.0.0.0:%d", port);
grpc_exec_ctx_finish (&exec_ctx);
@ -154,7 +154,7 @@ reconnect_server_poll (reconnect_server * server, int seconds)
gpr_time_from_seconds (seconds, GPR_TIMESPAN));
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
gpr_mu_lock (GRPC_POLLSET_MU (&server->pollset));
grpc_pollset_work (&server->pollset, &worker, gpr_now (GPR_CLOCK_MONOTONIC), deadline, &closure_list);
grpc_pollset_work (&server->pollset, &worker, gpr_now (&exec_ctx, GPR_CLOCK_MONOTONIC), deadline);
gpr_mu_unlock (GRPC_POLLSET_MU (&server->pollset));
grpc_exec_ctx_finish (&exec_ctx);
}
@ -186,9 +186,9 @@ reconnect_server_destroy (reconnect_server * server)
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], &closure_list);
grpc_tcp_server_destroy (&exec_ctx, server->tcp_server, &do_nothing_closure[0]);
reconnect_server_clear_timestamps (server);
grpc_pollset_shutdown (&server->pollset, &do_nothing_closure[1], &closure_list);
grpc_pollset_shutdown (&exec_ctx, &server->pollset, &do_nothing_closure[1]);
grpc_exec_ctx_finish (&exec_ctx);
grpc_pollset_destroy (&server->pollset);
grpc_shutdown ();

Loading…
Cancel
Save