diff options
author | Yash Tibrewal <yashkt@google.com> | 2017-11-14 18:11:22 -0800 |
---|---|---|
committer | Yash Tibrewal <yashkt@google.com> | 2017-11-14 18:11:22 -0800 |
commit | 6c26b16fe06b1cc75b4dac372f4f51f6b7d1bfc0 (patch) | |
tree | 5d9b7bbdcf125bfc103b67778349ea075b049bb4 /test/core/util | |
parent | 75122c23578e24417dcf64081c737571a9fc2dbc (diff) |
Move ExecCtx to grpc_core namespace. Make exec_ctx a private static in ExecCtx and some minor changes
Diffstat (limited to 'test/core/util')
-rw-r--r-- | test/core/util/port_server_client.cc | 24 | ||||
-rw-r--r-- | test/core/util/test_tcp_server.cc | 6 |
2 files changed, 16 insertions, 14 deletions
diff --git a/test/core/util/port_server_client.cc b/test/core/util/port_server_client.cc index 4e68ee3744..8e61145a26 100644 --- a/test/core/util/port_server_client.cc +++ b/test/core/util/port_server_client.cc @@ -62,7 +62,7 @@ void grpc_free_port_using_server(int port) { grpc_httpcli_response rsp; freereq pr; char* path; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_closure* shutdown_closure; grpc_init(); @@ -85,19 +85,20 @@ void grpc_free_port_using_server(int port) { grpc_resource_quota* resource_quota = grpc_resource_quota_create("port_server_client/free"); grpc_httpcli_get(&context, &pr.pops, resource_quota, &req, - ExecCtx::Get()->Now() + 30 * GPR_MS_PER_SEC, + grpc_core::ExecCtx::Get()->Now() + 30 * GPR_MS_PER_SEC, GRPC_CLOSURE_CREATE(freed_port_from_server, &pr, grpc_schedule_on_exec_ctx), &rsp); grpc_resource_quota_unref_internal(resource_quota); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); gpr_mu_lock(pr.mu); while (!pr.done) { grpc_pollset_worker* worker = NULL; if (!GRPC_LOG_IF_ERROR( "pollset_work", - grpc_pollset_work(grpc_polling_entity_pollset(&pr.pops), &worker, - ExecCtx::Get()->Now() + GPR_MS_PER_SEC))) { + grpc_pollset_work( + grpc_polling_entity_pollset(&pr.pops), &worker, + grpc_core::ExecCtx::Get()->Now() + GPR_MS_PER_SEC))) { pr.done = 1; } } @@ -167,7 +168,7 @@ static void got_port_from_server(void* arg, grpc_error* error) { grpc_resource_quota* resource_quota = grpc_resource_quota_create("port_server_client/pick_retry"); grpc_httpcli_get(pr->ctx, &pr->pops, resource_quota, &req, - ExecCtx::Get()->Now() + 30 * GPR_MS_PER_SEC, + grpc_core::ExecCtx::Get()->Now() + 30 * GPR_MS_PER_SEC, GRPC_CLOSURE_CREATE(got_port_from_server, pr, grpc_schedule_on_exec_ctx), &pr->response); @@ -193,7 +194,7 @@ int grpc_pick_port_using_server(void) { grpc_httpcli_context context; grpc_httpcli_request req; portreq pr; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_closure* shutdown_closure; grpc_init(); @@ -217,18 +218,19 @@ int grpc_pick_port_using_server(void) { grpc_resource_quota_create("port_server_client/pick"); grpc_httpcli_get( &context, &pr.pops, resource_quota, &req, - ExecCtx::Get()->Now() + 30 * GPR_MS_PER_SEC, + grpc_core::ExecCtx::Get()->Now() + 30 * GPR_MS_PER_SEC, GRPC_CLOSURE_CREATE(got_port_from_server, &pr, grpc_schedule_on_exec_ctx), &pr.response); grpc_resource_quota_unref_internal(resource_quota); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); gpr_mu_lock(pr.mu); while (pr.port == -1) { grpc_pollset_worker* worker = NULL; if (!GRPC_LOG_IF_ERROR( "pollset_work", - grpc_pollset_work(grpc_polling_entity_pollset(&pr.pops), &worker, - ExecCtx::Get()->Now() + GPR_MS_PER_SEC))) { + grpc_pollset_work( + grpc_polling_entity_pollset(&pr.pops), &worker, + grpc_core::ExecCtx::Get()->Now() + GPR_MS_PER_SEC))) { pr.port = 0; } } diff --git a/test/core/util/test_tcp_server.cc b/test/core/util/test_tcp_server.cc index 7e17ff1f53..6418a7dfaa 100644 --- a/test/core/util/test_tcp_server.cc +++ b/test/core/util/test_tcp_server.cc @@ -55,7 +55,7 @@ void test_tcp_server_start(test_tcp_server* server, int port) { grpc_resolved_address resolved_addr; struct sockaddr_in* addr = (struct sockaddr_in*)resolved_addr.addr; int port_added; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; addr->sin_family = AF_INET; addr->sin_port = htons((uint16_t)port); @@ -76,7 +76,7 @@ void test_tcp_server_start(test_tcp_server* server, int port) { void test_tcp_server_poll(test_tcp_server* server, int seconds) { grpc_pollset_worker* worker = NULL; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_millis deadline = grpc_timespec_to_millis_round_up( grpc_timeout_seconds_to_deadline(seconds)); gpr_mu_lock(server->mu); @@ -91,7 +91,7 @@ static void finish_pollset(void* arg, grpc_error* error) { } void test_tcp_server_destroy(test_tcp_server* server) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; gpr_timespec shutdown_deadline; grpc_closure do_nothing_cb; grpc_tcp_server_unref(server->tcp_server); |