aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core/end2end/fixtures
diff options
context:
space:
mode:
Diffstat (limited to 'test/core/end2end/fixtures')
-rw-r--r--test/core/end2end/fixtures/h2_census.cc10
-rw-r--r--test/core/end2end/fixtures/h2_compress.cc17
-rw-r--r--test/core/end2end/fixtures/h2_fd.cc8
-rw-r--r--test/core/end2end/fixtures/h2_full+workarounds.cc5
-rw-r--r--test/core/end2end/fixtures/h2_load_reporting.cc5
-rw-r--r--test/core/end2end/fixtures/h2_oauth2.cc7
-rw-r--r--test/core/end2end/fixtures/h2_sockpair+trace.cc35
-rw-r--r--test/core/end2end/fixtures/h2_sockpair.cc33
-rw-r--r--test/core/end2end/fixtures/h2_sockpair_1byte.cc33
-rw-r--r--test/core/end2end/fixtures/h2_ssl.cc5
-rw-r--r--test/core/end2end/fixtures/h2_ssl_proxy.cc10
-rw-r--r--test/core/end2end/fixtures/http_proxy_fixture.cc195
-rw-r--r--test/core/end2end/fixtures/proxy.cc3
13 files changed, 152 insertions, 214 deletions
diff --git a/test/core/end2end/fixtures/h2_census.cc b/test/core/end2end/fixtures/h2_census.cc
index fed8ead5c8..75c80aa1ff 100644
--- a/test/core/end2end/fixtures/h2_census.cc
+++ b/test/core/end2end/fixtures/h2_census.cc
@@ -75,9 +75,8 @@ void chttp2_init_client_fullstack(grpc_end2end_test_fixture* f,
grpc_insecure_channel_create(ffd->localaddr, client_args, nullptr);
GPR_ASSERT(f->client);
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_channel_args_destroy(&exec_ctx, client_args);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_core::ExecCtx exec_ctx;
+ grpc_channel_args_destroy(client_args);
}
}
@@ -92,9 +91,8 @@ void chttp2_init_server_fullstack(grpc_end2end_test_fixture* f,
server_args = grpc_channel_args_copy_and_add(server_args, &arg, 1);
f->server = grpc_server_create(server_args, nullptr);
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_channel_args_destroy(&exec_ctx, server_args);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_core::ExecCtx exec_ctx;
+ grpc_channel_args_destroy(server_args);
}
grpc_server_register_completion_queue(f->server, f->cq, nullptr);
GPR_ASSERT(grpc_server_add_insecure_http2_port(f->server, ffd->localaddr));
diff --git a/test/core/end2end/fixtures/h2_compress.cc b/test/core/end2end/fixtures/h2_compress.cc
index ea8990fd0a..5b9181586c 100644
--- a/test/core/end2end/fixtures/h2_compress.cc
+++ b/test/core/end2end/fixtures/h2_compress.cc
@@ -66,9 +66,8 @@ void chttp2_init_client_fullstack_compression(grpc_end2end_test_fixture* f,
fullstack_compression_fixture_data* ffd =
static_cast<fullstack_compression_fixture_data*>(f->fixture_data);
if (ffd->client_args_compression != nullptr) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_channel_args_destroy(&exec_ctx, ffd->client_args_compression);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_core::ExecCtx exec_ctx;
+ grpc_channel_args_destroy(ffd->client_args_compression);
}
ffd->client_args_compression = grpc_channel_args_set_compression_algorithm(
client_args, GRPC_COMPRESS_GZIP);
@@ -81,9 +80,8 @@ void chttp2_init_server_fullstack_compression(grpc_end2end_test_fixture* f,
fullstack_compression_fixture_data* ffd =
static_cast<fullstack_compression_fixture_data*>(f->fixture_data);
if (ffd->server_args_compression != nullptr) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_channel_args_destroy(&exec_ctx, ffd->server_args_compression);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_core::ExecCtx exec_ctx;
+ grpc_channel_args_destroy(ffd->server_args_compression);
}
ffd->server_args_compression = grpc_channel_args_set_compression_algorithm(
server_args, GRPC_COMPRESS_GZIP);
@@ -97,14 +95,13 @@ void chttp2_init_server_fullstack_compression(grpc_end2end_test_fixture* f,
}
void chttp2_tear_down_fullstack_compression(grpc_end2end_test_fixture* f) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_core::ExecCtx exec_ctx;
fullstack_compression_fixture_data* ffd =
static_cast<fullstack_compression_fixture_data*>(f->fixture_data);
- grpc_channel_args_destroy(&exec_ctx, ffd->client_args_compression);
- grpc_channel_args_destroy(&exec_ctx, ffd->server_args_compression);
+ grpc_channel_args_destroy(ffd->client_args_compression);
+ grpc_channel_args_destroy(ffd->server_args_compression);
gpr_free(ffd->localaddr);
gpr_free(ffd);
- grpc_exec_ctx_finish(&exec_ctx);
}
/* All test configurations */
diff --git a/test/core/end2end/fixtures/h2_fd.cc b/test/core/end2end/fixtures/h2_fd.cc
index 97f4b71bf0..9157ab04d0 100644
--- a/test/core/end2end/fixtures/h2_fd.cc
+++ b/test/core/end2end/fixtures/h2_fd.cc
@@ -68,20 +68,18 @@ 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_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_core::ExecCtx exec_ctx;
sp_fixture_data* sfd = static_cast<sp_fixture_data*>(f->fixture_data);
GPR_ASSERT(!f->client);
f->client = grpc_insecure_channel_create_from_fd(
"fixture_client", sfd->fd_pair[0], client_args);
GPR_ASSERT(f->client);
-
- grpc_exec_ctx_finish(&exec_ctx);
}
static void chttp2_init_server_socketpair(grpc_end2end_test_fixture* f,
grpc_channel_args* server_args) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_core::ExecCtx exec_ctx;
sp_fixture_data* sfd = static_cast<sp_fixture_data*>(f->fixture_data);
GPR_ASSERT(!f->server);
f->server = grpc_server_create(server_args, nullptr);
@@ -90,8 +88,6 @@ static void chttp2_init_server_socketpair(grpc_end2end_test_fixture* f,
grpc_server_start(f->server);
grpc_server_add_insecure_channel_from_fd(f->server, nullptr, sfd->fd_pair[1]);
-
- grpc_exec_ctx_finish(&exec_ctx);
}
static void chttp2_tear_down_socketpair(grpc_end2end_test_fixture* f) {
diff --git a/test/core/end2end/fixtures/h2_full+workarounds.cc b/test/core/end2end/fixtures/h2_full+workarounds.cc
index 71a497d796..237841d185 100644
--- a/test/core/end2end/fixtures/h2_full+workarounds.cc
+++ b/test/core/end2end/fixtures/h2_full+workarounds.cc
@@ -72,7 +72,7 @@ void chttp2_init_client_fullstack(grpc_end2end_test_fixture* f,
void chttp2_init_server_fullstack(grpc_end2end_test_fixture* f,
grpc_channel_args* server_args) {
int i;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_core::ExecCtx exec_ctx;
fullstack_fixture_data* ffd =
static_cast<fullstack_fixture_data*>(f->fixture_data);
grpc_arg args[GRPC_MAX_WORKAROUND_ID];
@@ -90,8 +90,7 @@ void chttp2_init_server_fullstack(grpc_end2end_test_fixture* f,
grpc_server_register_completion_queue(f->server, f->cq, nullptr);
GPR_ASSERT(grpc_server_add_insecure_http2_port(f->server, ffd->localaddr));
grpc_server_start(f->server);
- grpc_channel_args_destroy(&exec_ctx, server_args_new);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_channel_args_destroy(server_args_new);
}
void chttp2_tear_down_fullstack(grpc_end2end_test_fixture* f) {
diff --git a/test/core/end2end/fixtures/h2_load_reporting.cc b/test/core/end2end/fixtures/h2_load_reporting.cc
index 7486b6af78..fda5f4b052 100644
--- a/test/core/end2end/fixtures/h2_load_reporting.cc
+++ b/test/core/end2end/fixtures/h2_load_reporting.cc
@@ -78,9 +78,8 @@ void chttp2_init_server_load_reporting(grpc_end2end_test_fixture* f,
server_args = grpc_channel_args_copy_and_add(server_args, &arg, 1);
f->server = grpc_server_create(server_args, nullptr);
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_channel_args_destroy(&exec_ctx, server_args);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_core::ExecCtx exec_ctx;
+ grpc_channel_args_destroy(server_args);
}
grpc_server_register_completion_queue(f->server, f->cq, nullptr);
GPR_ASSERT(grpc_server_add_insecure_http2_port(f->server, ffd->localaddr));
diff --git a/test/core/end2end/fixtures/h2_oauth2.cc b/test/core/end2end/fixtures/h2_oauth2.cc
index 1642cb0db9..5fed4434de 100644
--- a/test/core/end2end/fixtures/h2_oauth2.cc
+++ b/test/core/end2end/fixtures/h2_oauth2.cc
@@ -143,11 +143,11 @@ void chttp2_tear_down_secure_fullstack(grpc_end2end_test_fixture* f) {
static void chttp2_init_client_simple_ssl_with_oauth2_secure_fullstack(
grpc_end2end_test_fixture* f, grpc_channel_args* client_args) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_core::ExecCtx exec_ctx;
grpc_channel_credentials* ssl_creds =
grpc_ssl_credentials_create(test_root_cert, nullptr, nullptr);
grpc_call_credentials* oauth2_creds = grpc_md_only_test_credentials_create(
- &exec_ctx, "authorization", oauth2_md, true /* is_async */);
+ "authorization", oauth2_md, true /* is_async */);
grpc_channel_credentials* ssl_oauth2_creds =
grpc_composite_channel_credentials_create(ssl_creds, oauth2_creds,
nullptr);
@@ -158,10 +158,9 @@ static void chttp2_init_client_simple_ssl_with_oauth2_secure_fullstack(
grpc_channel_args* new_client_args =
grpc_channel_args_copy_and_add(client_args, &ssl_name_override, 1);
chttp2_init_client_secure_fullstack(f, new_client_args, ssl_oauth2_creds);
- grpc_channel_args_destroy(&exec_ctx, new_client_args);
+ grpc_channel_args_destroy(new_client_args);
grpc_channel_credentials_release(ssl_creds);
grpc_call_credentials_release(oauth2_creds);
- grpc_exec_ctx_finish(&exec_ctx);
}
static int fail_server_auth_check(grpc_channel_args* server_args) {
diff --git a/test/core/end2end/fixtures/h2_sockpair+trace.cc b/test/core/end2end/fixtures/h2_sockpair+trace.cc
index 9319c401dc..9807e929af 100644
--- a/test/core/end2end/fixtures/h2_sockpair+trace.cc
+++ b/test/core/end2end/fixtures/h2_sockpair+trace.cc
@@ -50,12 +50,11 @@
static void server_setup_transport(void* ts, grpc_transport* transport) {
grpc_end2end_test_fixture* f = static_cast<grpc_end2end_test_fixture*>(ts);
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_core::ExecCtx exec_ctx;
grpc_endpoint_pair* sfd = static_cast<grpc_endpoint_pair*>(f->fixture_data);
- grpc_endpoint_add_to_pollset(&exec_ctx, sfd->server, grpc_cq_pollset(f->cq));
- grpc_server_setup_transport(&exec_ctx, f->server, transport, nullptr,
+ grpc_endpoint_add_to_pollset(sfd->server, grpc_cq_pollset(f->cq));
+ grpc_server_setup_transport(f->server, transport, nullptr,
grpc_server_get_channel_args(f->server));
- grpc_exec_ctx_finish(&exec_ctx);
}
typedef struct {
@@ -63,13 +62,11 @@ typedef struct {
grpc_channel_args* client_args;
} sp_client_setup;
-static void client_setup_transport(grpc_exec_ctx* exec_ctx, void* ts,
- grpc_transport* transport) {
+static void client_setup_transport(void* ts, grpc_transport* transport) {
sp_client_setup* cs = static_cast<sp_client_setup*>(ts);
- cs->f->client =
- grpc_channel_create(exec_ctx, "socketpair-target", cs->client_args,
- GRPC_CLIENT_DIRECT_CHANNEL, transport);
+ cs->f->client = grpc_channel_create("socketpair-target", cs->client_args,
+ GRPC_CLIENT_DIRECT_CHANNEL, transport);
}
static grpc_end2end_test_fixture chttp2_create_fixture_socketpair(
@@ -90,34 +87,30 @@ 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_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_core::ExecCtx exec_ctx;
grpc_endpoint_pair* sfd = static_cast<grpc_endpoint_pair*>(f->fixture_data);
grpc_transport* transport;
sp_client_setup cs;
cs.client_args = client_args;
cs.f = f;
- transport =
- grpc_create_chttp2_transport(&exec_ctx, client_args, sfd->client, true);
- client_setup_transport(&exec_ctx, &cs, transport);
+ transport = grpc_create_chttp2_transport(client_args, sfd->client, true);
+ client_setup_transport(&cs, transport);
GPR_ASSERT(f->client);
- grpc_chttp2_transport_start_reading(&exec_ctx, transport, nullptr, nullptr);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_chttp2_transport_start_reading(transport, nullptr, nullptr);
}
static void chttp2_init_server_socketpair(grpc_end2end_test_fixture* f,
grpc_channel_args* server_args) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_core::ExecCtx exec_ctx;
grpc_endpoint_pair* sfd = static_cast<grpc_endpoint_pair*>(f->fixture_data);
grpc_transport* transport;
GPR_ASSERT(!f->server);
f->server = grpc_server_create(server_args, nullptr);
grpc_server_register_completion_queue(f->server, f->cq, nullptr);
grpc_server_start(f->server);
- transport =
- grpc_create_chttp2_transport(&exec_ctx, server_args, sfd->server, false);
+ transport = grpc_create_chttp2_transport(server_args, sfd->server, false);
server_setup_transport(f, transport);
- grpc_chttp2_transport_start_reading(&exec_ctx, transport, nullptr, nullptr);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_chttp2_transport_start_reading(transport, nullptr, nullptr);
}
static void chttp2_tear_down_socketpair(grpc_end2end_test_fixture* f) {
@@ -133,7 +126,6 @@ static grpc_end2end_test_config configs[] = {
int main(int argc, char** argv) {
size_t i;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
/* force tracing on, with a value to force many
code paths in trace.c to be taken */
@@ -147,7 +139,6 @@ int main(int argc, char** argv) {
grpc_test_init(argc, argv);
grpc_end2end_tests_pre_init();
grpc_init();
- grpc_exec_ctx_finish(&exec_ctx);
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.cc b/test/core/end2end/fixtures/h2_sockpair.cc
index 03566aada2..b68279fd71 100644
--- a/test/core/end2end/fixtures/h2_sockpair.cc
+++ b/test/core/end2end/fixtures/h2_sockpair.cc
@@ -44,12 +44,11 @@
static void server_setup_transport(void* ts, grpc_transport* transport) {
grpc_end2end_test_fixture* f = static_cast<grpc_end2end_test_fixture*>(ts);
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_core::ExecCtx exec_ctx;
grpc_endpoint_pair* sfd = static_cast<grpc_endpoint_pair*>(f->fixture_data);
- grpc_endpoint_add_to_pollset(&exec_ctx, sfd->server, grpc_cq_pollset(f->cq));
- grpc_server_setup_transport(&exec_ctx, f->server, transport, nullptr,
+ grpc_endpoint_add_to_pollset(sfd->server, grpc_cq_pollset(f->cq));
+ grpc_server_setup_transport(f->server, transport, nullptr,
grpc_server_get_channel_args(f->server));
- grpc_exec_ctx_finish(&exec_ctx);
}
typedef struct {
@@ -57,13 +56,11 @@ typedef struct {
grpc_channel_args* client_args;
} sp_client_setup;
-static void client_setup_transport(grpc_exec_ctx* exec_ctx, void* ts,
- grpc_transport* transport) {
+static void client_setup_transport(void* ts, grpc_transport* transport) {
sp_client_setup* cs = static_cast<sp_client_setup*>(ts);
- cs->f->client =
- grpc_channel_create(exec_ctx, "socketpair-target", cs->client_args,
- GRPC_CLIENT_DIRECT_CHANNEL, transport);
+ cs->f->client = grpc_channel_create("socketpair-target", cs->client_args,
+ GRPC_CLIENT_DIRECT_CHANNEL, transport);
}
static grpc_end2end_test_fixture chttp2_create_fixture_socketpair(
@@ -84,34 +81,30 @@ 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_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_core::ExecCtx exec_ctx;
grpc_endpoint_pair* sfd = static_cast<grpc_endpoint_pair*>(f->fixture_data);
grpc_transport* transport;
sp_client_setup cs;
cs.client_args = client_args;
cs.f = f;
- transport =
- grpc_create_chttp2_transport(&exec_ctx, client_args, sfd->client, true);
- client_setup_transport(&exec_ctx, &cs, transport);
+ transport = grpc_create_chttp2_transport(client_args, sfd->client, true);
+ client_setup_transport(&cs, transport);
GPR_ASSERT(f->client);
- grpc_chttp2_transport_start_reading(&exec_ctx, transport, nullptr, nullptr);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_chttp2_transport_start_reading(transport, nullptr, nullptr);
}
static void chttp2_init_server_socketpair(grpc_end2end_test_fixture* f,
grpc_channel_args* server_args) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_core::ExecCtx exec_ctx;
grpc_endpoint_pair* sfd = static_cast<grpc_endpoint_pair*>(f->fixture_data);
grpc_transport* transport;
GPR_ASSERT(!f->server);
f->server = grpc_server_create(server_args, nullptr);
grpc_server_register_completion_queue(f->server, f->cq, nullptr);
grpc_server_start(f->server);
- transport =
- grpc_create_chttp2_transport(&exec_ctx, server_args, sfd->server, false);
+ transport = grpc_create_chttp2_transport(server_args, sfd->server, false);
server_setup_transport(f, transport);
- grpc_chttp2_transport_start_reading(&exec_ctx, transport, nullptr, nullptr);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_chttp2_transport_start_reading(transport, nullptr, nullptr);
}
static void chttp2_tear_down_socketpair(grpc_end2end_test_fixture* f) {
diff --git a/test/core/end2end/fixtures/h2_sockpair_1byte.cc b/test/core/end2end/fixtures/h2_sockpair_1byte.cc
index 9adba00204..350be138ca 100644
--- a/test/core/end2end/fixtures/h2_sockpair_1byte.cc
+++ b/test/core/end2end/fixtures/h2_sockpair_1byte.cc
@@ -44,12 +44,11 @@
static void server_setup_transport(void* ts, grpc_transport* transport) {
grpc_end2end_test_fixture* f = static_cast<grpc_end2end_test_fixture*>(ts);
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_core::ExecCtx exec_ctx;
grpc_endpoint_pair* sfd = static_cast<grpc_endpoint_pair*>(f->fixture_data);
- grpc_endpoint_add_to_pollset(&exec_ctx, sfd->server, grpc_cq_pollset(f->cq));
- grpc_server_setup_transport(&exec_ctx, f->server, transport, nullptr,
+ grpc_endpoint_add_to_pollset(sfd->server, grpc_cq_pollset(f->cq));
+ grpc_server_setup_transport(f->server, transport, nullptr,
grpc_server_get_channel_args(f->server));
- grpc_exec_ctx_finish(&exec_ctx);
}
typedef struct {
@@ -57,13 +56,11 @@ typedef struct {
grpc_channel_args* client_args;
} sp_client_setup;
-static void client_setup_transport(grpc_exec_ctx* exec_ctx, void* ts,
- grpc_transport* transport) {
+static void client_setup_transport(void* ts, grpc_transport* transport) {
sp_client_setup* cs = static_cast<sp_client_setup*>(ts);
- cs->f->client =
- grpc_channel_create(exec_ctx, "socketpair-target", cs->client_args,
- GRPC_CLIENT_DIRECT_CHANNEL, transport);
+ cs->f->client = grpc_channel_create("socketpair-target", cs->client_args,
+ GRPC_CLIENT_DIRECT_CHANNEL, transport);
}
static grpc_end2end_test_fixture chttp2_create_fixture_socketpair(
@@ -95,34 +92,30 @@ 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_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_core::ExecCtx exec_ctx;
grpc_endpoint_pair* sfd = static_cast<grpc_endpoint_pair*>(f->fixture_data);
grpc_transport* transport;
sp_client_setup cs;
cs.client_args = client_args;
cs.f = f;
- transport =
- grpc_create_chttp2_transport(&exec_ctx, client_args, sfd->client, true);
- client_setup_transport(&exec_ctx, &cs, transport);
+ transport = grpc_create_chttp2_transport(client_args, sfd->client, true);
+ client_setup_transport(&cs, transport);
GPR_ASSERT(f->client);
- grpc_chttp2_transport_start_reading(&exec_ctx, transport, nullptr, nullptr);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_chttp2_transport_start_reading(transport, nullptr, nullptr);
}
static void chttp2_init_server_socketpair(grpc_end2end_test_fixture* f,
grpc_channel_args* server_args) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_core::ExecCtx exec_ctx;
grpc_endpoint_pair* sfd = static_cast<grpc_endpoint_pair*>(f->fixture_data);
grpc_transport* transport;
GPR_ASSERT(!f->server);
f->server = grpc_server_create(server_args, nullptr);
grpc_server_register_completion_queue(f->server, f->cq, nullptr);
grpc_server_start(f->server);
- transport =
- grpc_create_chttp2_transport(&exec_ctx, server_args, sfd->server, false);
+ transport = grpc_create_chttp2_transport(server_args, sfd->server, false);
server_setup_transport(f, transport);
- grpc_chttp2_transport_start_reading(&exec_ctx, transport, nullptr, nullptr);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_chttp2_transport_start_reading(transport, nullptr, nullptr);
}
static void chttp2_tear_down_socketpair(grpc_end2end_test_fixture* f) {
diff --git a/test/core/end2end/fixtures/h2_ssl.cc b/test/core/end2end/fixtures/h2_ssl.cc
index 3d7e2e327e..9a0680c40e 100644
--- a/test/core/end2end/fixtures/h2_ssl.cc
+++ b/test/core/end2end/fixtures/h2_ssl.cc
@@ -110,9 +110,8 @@ static void chttp2_init_client_simple_ssl_secure_fullstack(
grpc_channel_args_copy_and_add(client_args, &ssl_name_override, 1);
chttp2_init_client_secure_fullstack(f, new_client_args, ssl_creds);
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_channel_args_destroy(&exec_ctx, new_client_args);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_core::ExecCtx exec_ctx;
+ grpc_channel_args_destroy(new_client_args);
}
}
diff --git a/test/core/end2end/fixtures/h2_ssl_proxy.cc b/test/core/end2end/fixtures/h2_ssl_proxy.cc
index f8d5a699e4..5ddbdefc8c 100644
--- a/test/core/end2end/fixtures/h2_ssl_proxy.cc
+++ b/test/core/end2end/fixtures/h2_ssl_proxy.cc
@@ -66,9 +66,8 @@ static grpc_channel* create_proxy_client(const char* target,
grpc_secure_channel_create(ssl_creds, target, new_client_args, nullptr);
grpc_channel_credentials_release(ssl_creds);
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_channel_args_destroy(&exec_ctx, new_client_args);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_core::ExecCtx exec_ctx;
+ grpc_channel_args_destroy(new_client_args);
}
return channel;
}
@@ -148,9 +147,8 @@ static void chttp2_init_client_simple_ssl_secure_fullstack(
grpc_channel_args_copy_and_add(client_args, &ssl_name_override, 1);
chttp2_init_client_secure_fullstack(f, new_client_args, ssl_creds);
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_channel_args_destroy(&exec_ctx, new_client_args);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_core::ExecCtx exec_ctx;
+ grpc_channel_args_destroy(new_client_args);
}
}
diff --git a/test/core/end2end/fixtures/http_proxy_fixture.cc b/test/core/end2end/fixtures/http_proxy_fixture.cc
index 0cec27bad7..137f7c9fa3 100644
--- a/test/core/end2end/fixtures/http_proxy_fixture.cc
+++ b/test/core/end2end/fixtures/http_proxy_fixture.cc
@@ -116,24 +116,21 @@ static void proxy_connection_ref(proxy_connection* conn, const char* reason) {
}
// Helper function to destroy the proxy connection.
-static void proxy_connection_unref(grpc_exec_ctx* exec_ctx,
- proxy_connection* conn, const char* reason) {
+static void proxy_connection_unref(proxy_connection* conn, const char* reason) {
if (gpr_unref(&conn->refcount)) {
gpr_log(GPR_DEBUG, "endpoints: %p %p", conn->client_endpoint,
conn->server_endpoint);
- grpc_endpoint_destroy(exec_ctx, conn->client_endpoint);
+ grpc_endpoint_destroy(conn->client_endpoint);
if (conn->server_endpoint != nullptr) {
- grpc_endpoint_destroy(exec_ctx, conn->server_endpoint);
+ grpc_endpoint_destroy(conn->server_endpoint);
}
- grpc_pollset_set_destroy(exec_ctx, conn->pollset_set);
- grpc_slice_buffer_destroy_internal(exec_ctx, &conn->client_read_buffer);
- grpc_slice_buffer_destroy_internal(exec_ctx,
- &conn->client_deferred_write_buffer);
- grpc_slice_buffer_destroy_internal(exec_ctx, &conn->client_write_buffer);
- grpc_slice_buffer_destroy_internal(exec_ctx, &conn->server_read_buffer);
- grpc_slice_buffer_destroy_internal(exec_ctx,
- &conn->server_deferred_write_buffer);
- grpc_slice_buffer_destroy_internal(exec_ctx, &conn->server_write_buffer);
+ grpc_pollset_set_destroy(conn->pollset_set);
+ grpc_slice_buffer_destroy_internal(&conn->client_read_buffer);
+ grpc_slice_buffer_destroy_internal(&conn->client_deferred_write_buffer);
+ grpc_slice_buffer_destroy_internal(&conn->client_write_buffer);
+ grpc_slice_buffer_destroy_internal(&conn->server_read_buffer);
+ grpc_slice_buffer_destroy_internal(&conn->server_deferred_write_buffer);
+ grpc_slice_buffer_destroy_internal(&conn->server_write_buffer);
grpc_http_parser_destroy(&conn->http_parser);
grpc_http_request_destroy(&conn->http_request);
gpr_unref(&conn->proxy->users);
@@ -150,8 +147,7 @@ enum failure_type {
};
// Helper function to shut down the proxy connection.
-static void proxy_connection_failed(grpc_exec_ctx* exec_ctx,
- proxy_connection* conn,
+static void proxy_connection_failed(proxy_connection* conn,
failure_type failure, const char* prefix,
grpc_error* error) {
gpr_log(GPR_INFO, "%s: %s", prefix, grpc_error_string(error));
@@ -175,28 +171,25 @@ static void proxy_connection_failed(grpc_exec_ctx* exec_ctx,
}
// If we decided to shut down either one and have not yet done so, do so.
if (shutdown_client && !conn->client_shutdown) {
- grpc_endpoint_shutdown(exec_ctx, conn->client_endpoint,
- GRPC_ERROR_REF(error));
+ grpc_endpoint_shutdown(conn->client_endpoint, GRPC_ERROR_REF(error));
conn->client_shutdown = true;
}
if (shutdown_server && !conn->server_shutdown &&
(conn->server_endpoint != nullptr)) {
- grpc_endpoint_shutdown(exec_ctx, conn->server_endpoint,
- GRPC_ERROR_REF(error));
+ grpc_endpoint_shutdown(conn->server_endpoint, GRPC_ERROR_REF(error));
conn->server_shutdown = true;
}
// Unref the connection.
- proxy_connection_unref(exec_ctx, conn, "conn_failed");
+ proxy_connection_unref(conn, "conn_failed");
GRPC_ERROR_UNREF(error);
}
// Callback for writing proxy data to the client.
-static void on_client_write_done(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error) {
+static void on_client_write_done(void* arg, grpc_error* error) {
proxy_connection* conn = (proxy_connection*)arg;
conn->client_is_writing = false;
if (error != GRPC_ERROR_NONE) {
- proxy_connection_failed(exec_ctx, conn, CLIENT_WRITE_FAILED,
+ proxy_connection_failed(conn, CLIENT_WRITE_FAILED,
"HTTP proxy client write", GRPC_ERROR_REF(error));
return;
}
@@ -208,22 +201,20 @@ static void on_client_write_done(grpc_exec_ctx* exec_ctx, void* arg,
grpc_slice_buffer_move_into(&conn->client_deferred_write_buffer,
&conn->client_write_buffer);
conn->client_is_writing = true;
- grpc_endpoint_write(exec_ctx, conn->client_endpoint,
- &conn->client_write_buffer,
+ grpc_endpoint_write(conn->client_endpoint, &conn->client_write_buffer,
&conn->on_client_write_done);
} else {
// No more writes. Unref the connection.
- proxy_connection_unref(exec_ctx, conn, "write_done");
+ proxy_connection_unref(conn, "write_done");
}
}
// Callback for writing proxy data to the backend server.
-static void on_server_write_done(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error) {
+static void on_server_write_done(void* arg, grpc_error* error) {
proxy_connection* conn = (proxy_connection*)arg;
conn->server_is_writing = false;
if (error != GRPC_ERROR_NONE) {
- proxy_connection_failed(exec_ctx, conn, SERVER_WRITE_FAILED,
+ proxy_connection_failed(conn, SERVER_WRITE_FAILED,
"HTTP proxy server write", GRPC_ERROR_REF(error));
return;
}
@@ -235,23 +226,21 @@ static void on_server_write_done(grpc_exec_ctx* exec_ctx, void* arg,
grpc_slice_buffer_move_into(&conn->server_deferred_write_buffer,
&conn->server_write_buffer);
conn->server_is_writing = true;
- grpc_endpoint_write(exec_ctx, conn->server_endpoint,
- &conn->server_write_buffer,
+ grpc_endpoint_write(conn->server_endpoint, &conn->server_write_buffer,
&conn->on_server_write_done);
} else {
// No more writes. Unref the connection.
- proxy_connection_unref(exec_ctx, conn, "server_write");
+ proxy_connection_unref(conn, "server_write");
}
}
// Callback for reading data from the client, which will be proxied to
// the backend server.
-static void on_client_read_done(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error) {
+static void on_client_read_done(void* arg, grpc_error* error) {
proxy_connection* conn = (proxy_connection*)arg;
if (error != GRPC_ERROR_NONE) {
- proxy_connection_failed(exec_ctx, conn, CLIENT_READ_FAILED,
- "HTTP proxy client read", GRPC_ERROR_REF(error));
+ proxy_connection_failed(conn, CLIENT_READ_FAILED, "HTTP proxy client read",
+ GRPC_ERROR_REF(error));
return;
}
// If there is already a pending write (i.e., server_write_buffer is
@@ -268,23 +257,21 @@ static void on_client_read_done(grpc_exec_ctx* exec_ctx, void* arg,
&conn->server_write_buffer);
proxy_connection_ref(conn, "client_read");
conn->server_is_writing = true;
- grpc_endpoint_write(exec_ctx, conn->server_endpoint,
- &conn->server_write_buffer,
+ grpc_endpoint_write(conn->server_endpoint, &conn->server_write_buffer,
&conn->on_server_write_done);
}
// Read more data.
- grpc_endpoint_read(exec_ctx, conn->client_endpoint, &conn->client_read_buffer,
+ grpc_endpoint_read(conn->client_endpoint, &conn->client_read_buffer,
&conn->on_client_read_done);
}
// Callback for reading data from the backend server, which will be
// proxied to the client.
-static void on_server_read_done(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error) {
+static void on_server_read_done(void* arg, grpc_error* error) {
proxy_connection* conn = (proxy_connection*)arg;
if (error != GRPC_ERROR_NONE) {
- proxy_connection_failed(exec_ctx, conn, SERVER_READ_FAILED,
- "HTTP proxy server read", GRPC_ERROR_REF(error));
+ proxy_connection_failed(conn, SERVER_READ_FAILED, "HTTP proxy server read",
+ GRPC_ERROR_REF(error));
return;
}
// If there is already a pending write (i.e., client_write_buffer is
@@ -301,23 +288,21 @@ static void on_server_read_done(grpc_exec_ctx* exec_ctx, void* arg,
&conn->client_write_buffer);
proxy_connection_ref(conn, "server_read");
conn->client_is_writing = true;
- grpc_endpoint_write(exec_ctx, conn->client_endpoint,
- &conn->client_write_buffer,
+ grpc_endpoint_write(conn->client_endpoint, &conn->client_write_buffer,
&conn->on_client_write_done);
}
// Read more data.
- grpc_endpoint_read(exec_ctx, conn->server_endpoint, &conn->server_read_buffer,
+ grpc_endpoint_read(conn->server_endpoint, &conn->server_read_buffer,
&conn->on_server_read_done);
}
// Callback to write the HTTP response for the CONNECT request.
-static void on_write_response_done(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error) {
+static void on_write_response_done(void* arg, grpc_error* error) {
proxy_connection* conn = (proxy_connection*)arg;
conn->client_is_writing = false;
if (error != GRPC_ERROR_NONE) {
- proxy_connection_failed(exec_ctx, conn, SETUP_FAILED,
- "HTTP proxy write response", GRPC_ERROR_REF(error));
+ proxy_connection_failed(conn, SETUP_FAILED, "HTTP proxy write response",
+ GRPC_ERROR_REF(error));
return;
}
// Clear write buffer.
@@ -327,17 +312,16 @@ static void on_write_response_done(grpc_exec_ctx* exec_ctx, void* arg,
// for the other one.
proxy_connection_ref(conn, "client_read");
proxy_connection_ref(conn, "server_read");
- proxy_connection_unref(exec_ctx, conn, "write_response");
- grpc_endpoint_read(exec_ctx, conn->client_endpoint, &conn->client_read_buffer,
+ proxy_connection_unref(conn, "write_response");
+ grpc_endpoint_read(conn->client_endpoint, &conn->client_read_buffer,
&conn->on_client_read_done);
- grpc_endpoint_read(exec_ctx, conn->server_endpoint, &conn->server_read_buffer,
+ grpc_endpoint_read(conn->server_endpoint, &conn->server_read_buffer,
&conn->on_server_read_done);
}
// Callback to connect to the backend server specified by the HTTP
// CONNECT request.
-static void on_server_connect_done(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error) {
+static void on_server_connect_done(void* arg, grpc_error* error) {
proxy_connection* conn = (proxy_connection*)arg;
if (error != GRPC_ERROR_NONE) {
// TODO(roth): Technically, in this case, we should handle the error
@@ -345,8 +329,8 @@ static void on_server_connect_done(grpc_exec_ctx* exec_ctx, void* arg,
// connection failed. However, for the purposes of this test code,
// it's fine to pretend this is a client-side error, which will
// cause the client connection to be dropped.
- proxy_connection_failed(exec_ctx, conn, SETUP_FAILED,
- "HTTP proxy server connect", GRPC_ERROR_REF(error));
+ proxy_connection_failed(conn, SETUP_FAILED, "HTTP proxy server connect",
+ GRPC_ERROR_REF(error));
return;
}
// We've established a connection, so send back a 200 response code to
@@ -356,8 +340,7 @@ static void on_server_connect_done(grpc_exec_ctx* exec_ctx, void* arg,
grpc_slice_from_copied_string("HTTP/1.0 200 connected\r\n\r\n");
grpc_slice_buffer_add(&conn->client_write_buffer, slice);
conn->client_is_writing = true;
- grpc_endpoint_write(exec_ctx, conn->client_endpoint,
- &conn->client_write_buffer,
+ grpc_endpoint_write(conn->client_endpoint, &conn->client_write_buffer,
&conn->on_write_response_done);
}
@@ -366,8 +349,7 @@ static void on_server_connect_done(grpc_exec_ctx* exec_ctx, void* arg,
* Basic <base64_encoded_expected_cred>
* Returns true if it matches, false otherwise
*/
-static bool proxy_auth_header_matches(grpc_exec_ctx* exec_ctx,
- char* proxy_auth_header_val,
+static bool proxy_auth_header_matches(char* proxy_auth_header_val,
char* expected_cred) {
GPR_ASSERT(proxy_auth_header_val != nullptr);
GPR_ASSERT(expected_cred != nullptr);
@@ -375,11 +357,10 @@ static bool proxy_auth_header_matches(grpc_exec_ctx* exec_ctx,
return false;
}
proxy_auth_header_val += 6;
- grpc_slice decoded_slice =
- grpc_base64_decode(exec_ctx, proxy_auth_header_val, 0);
+ grpc_slice decoded_slice = grpc_base64_decode(proxy_auth_header_val, 0);
const bool header_matches =
grpc_slice_str_cmp(decoded_slice, expected_cred) == 0;
- grpc_slice_unref_internal(exec_ctx, decoded_slice);
+ grpc_slice_unref_internal(decoded_slice);
return header_matches;
}
@@ -389,14 +370,13 @@ static bool proxy_auth_header_matches(grpc_exec_ctx* exec_ctx,
// the client indicating that the request failed. However, for the purposes
// of this test code, it's fine to pretend this is a client-side error,
// which will cause the client connection to be dropped.
-static void on_read_request_done(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error) {
+static void on_read_request_done(void* arg, grpc_error* error) {
proxy_connection* conn = (proxy_connection*)arg;
gpr_log(GPR_DEBUG, "on_read_request_done: %p %s", conn,
grpc_error_string(error));
if (error != GRPC_ERROR_NONE) {
- proxy_connection_failed(exec_ctx, conn, SETUP_FAILED,
- "HTTP proxy read request", GRPC_ERROR_REF(error));
+ proxy_connection_failed(conn, SETUP_FAILED, "HTTP proxy read request",
+ GRPC_ERROR_REF(error));
return;
}
// Read request and feed it to the parser.
@@ -405,8 +385,7 @@ static void on_read_request_done(grpc_exec_ctx* exec_ctx, void* arg,
error = grpc_http_parser_parse(
&conn->http_parser, conn->client_read_buffer.slices[i], nullptr);
if (error != GRPC_ERROR_NONE) {
- proxy_connection_failed(exec_ctx, conn, SETUP_FAILED,
- "HTTP proxy request parse",
+ proxy_connection_failed(conn, SETUP_FAILED, "HTTP proxy request parse",
GRPC_ERROR_REF(error));
GRPC_ERROR_UNREF(error);
return;
@@ -416,8 +395,8 @@ static void on_read_request_done(grpc_exec_ctx* exec_ctx, void* arg,
grpc_slice_buffer_reset_and_unref(&conn->client_read_buffer);
// If we're not done reading the request, read more data.
if (conn->http_parser.state != GRPC_HTTP_BODY) {
- grpc_endpoint_read(exec_ctx, conn->client_endpoint,
- &conn->client_read_buffer, &conn->on_read_request_done);
+ grpc_endpoint_read(conn->client_endpoint, &conn->client_read_buffer,
+ &conn->on_read_request_done);
return;
}
// Make sure we got a CONNECT request.
@@ -427,8 +406,8 @@ static void on_read_request_done(grpc_exec_ctx* exec_ctx, void* arg,
conn->http_request.method);
error = GRPC_ERROR_CREATE_FROM_COPIED_STRING(msg);
gpr_free(msg);
- proxy_connection_failed(exec_ctx, conn, SETUP_FAILED,
- "HTTP proxy read request", GRPC_ERROR_REF(error));
+ proxy_connection_failed(conn, SETUP_FAILED, "HTTP proxy read request",
+ GRPC_ERROR_REF(error));
GRPC_ERROR_UNREF(error);
return;
}
@@ -440,16 +419,15 @@ static void on_read_request_done(grpc_exec_ctx* exec_ctx, void* arg,
for (size_t i = 0; i < conn->http_request.hdr_count; i++) {
if (strcmp(conn->http_request.hdrs[i].key, "Proxy-Authorization") == 0) {
client_authenticated = proxy_auth_header_matches(
- exec_ctx, conn->http_request.hdrs[i].value,
- proxy_auth_arg->value.string);
+ conn->http_request.hdrs[i].value, proxy_auth_arg->value.string);
break;
}
}
if (!client_authenticated) {
const char* msg = "HTTP Connect could not verify authentication";
error = GRPC_ERROR_CREATE_FROM_STATIC_STRING(msg);
- proxy_connection_failed(exec_ctx, conn, SETUP_FAILED,
- "HTTP proxy read request", GRPC_ERROR_REF(error));
+ proxy_connection_failed(conn, SETUP_FAILED, "HTTP proxy read request",
+ GRPC_ERROR_REF(error));
GRPC_ERROR_UNREF(error);
return;
}
@@ -459,8 +437,8 @@ static void on_read_request_done(grpc_exec_ctx* exec_ctx, void* arg,
error = grpc_blocking_resolve_address(conn->http_request.path, "80",
&resolved_addresses);
if (error != GRPC_ERROR_NONE) {
- proxy_connection_failed(exec_ctx, conn, SETUP_FAILED,
- "HTTP proxy DNS lookup", GRPC_ERROR_REF(error));
+ proxy_connection_failed(conn, SETUP_FAILED, "HTTP proxy DNS lookup",
+ GRPC_ERROR_REF(error));
GRPC_ERROR_UNREF(error);
return;
}
@@ -468,15 +446,15 @@ static void on_read_request_done(grpc_exec_ctx* exec_ctx, void* arg,
// Connect to requested address.
// The connection callback inherits our reference to conn.
const grpc_millis deadline =
- grpc_exec_ctx_now(exec_ctx) + 10 * GPR_MS_PER_SEC;
- grpc_tcp_client_connect(exec_ctx, &conn->on_server_connect_done,
- &conn->server_endpoint, conn->pollset_set, nullptr,
+ grpc_core::ExecCtx::Get()->Now() + 10 * GPR_MS_PER_SEC;
+ grpc_tcp_client_connect(&conn->on_server_connect_done, &conn->server_endpoint,
+ conn->pollset_set, nullptr,
&resolved_addresses->addrs[0], deadline);
grpc_resolved_addresses_destroy(resolved_addresses);
}
-static void on_accept(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_endpoint* endpoint, grpc_pollset* accepting_pollset,
+static void on_accept(void* arg, grpc_endpoint* endpoint,
+ grpc_pollset* accepting_pollset,
grpc_tcp_server_acceptor* acceptor) {
gpr_free(acceptor);
grpc_end2end_http_proxy* proxy = (grpc_end2end_http_proxy*)arg;
@@ -487,8 +465,8 @@ static void on_accept(grpc_exec_ctx* exec_ctx, void* arg,
conn->proxy = proxy;
gpr_ref_init(&conn->refcount, 1);
conn->pollset_set = grpc_pollset_set_create();
- grpc_pollset_set_add_pollset(exec_ctx, conn->pollset_set, proxy->pollset);
- grpc_endpoint_add_to_pollset_set(exec_ctx, endpoint, conn->pollset_set);
+ grpc_pollset_set_add_pollset(conn->pollset_set, proxy->pollset);
+ grpc_endpoint_add_to_pollset_set(endpoint, conn->pollset_set);
GRPC_CLOSURE_INIT(&conn->on_read_request_done, on_read_request_done, conn,
grpc_combiner_scheduler(conn->proxy->combiner));
GRPC_CLOSURE_INIT(&conn->on_server_connect_done, on_server_connect_done, conn,
@@ -513,7 +491,7 @@ static void on_accept(grpc_exec_ctx* exec_ctx, void* arg,
grpc_slice_buffer_init(&conn->server_write_buffer);
grpc_http_parser_init(&conn->http_parser, GRPC_HTTP_REQUEST,
&conn->http_request);
- grpc_endpoint_read(exec_ctx, conn->client_endpoint, &conn->client_read_buffer,
+ grpc_endpoint_read(conn->client_endpoint, &conn->client_read_buffer,
&conn->on_read_request_done);
}
@@ -523,24 +501,23 @@ static void on_accept(grpc_exec_ctx* exec_ctx, void* arg,
static void thread_main(void* arg) {
grpc_end2end_http_proxy* proxy = (grpc_end2end_http_proxy*)arg;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_core::ExecCtx exec_ctx;
do {
gpr_ref(&proxy->users);
grpc_pollset_worker* worker = nullptr;
gpr_mu_lock(proxy->mu);
GRPC_LOG_IF_ERROR(
"grpc_pollset_work",
- grpc_pollset_work(&exec_ctx, proxy->pollset, &worker,
- grpc_exec_ctx_now(&exec_ctx) + GPR_MS_PER_SEC));
+ grpc_pollset_work(proxy->pollset, &worker,
+ grpc_core::ExecCtx::Get()->Now() + GPR_MS_PER_SEC));
gpr_mu_unlock(proxy->mu);
- grpc_exec_ctx_flush(&exec_ctx);
+ grpc_core::ExecCtx::Get()->Flush();
} while (!gpr_unref(&proxy->users));
- grpc_exec_ctx_finish(&exec_ctx);
}
grpc_end2end_http_proxy* grpc_end2end_http_proxy_create(
grpc_channel_args* args) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_core::ExecCtx exec_ctx;
grpc_end2end_http_proxy* proxy =
(grpc_end2end_http_proxy*)gpr_malloc(sizeof(*proxy));
memset(proxy, 0, sizeof(*proxy));
@@ -552,8 +529,8 @@ grpc_end2end_http_proxy* grpc_end2end_http_proxy_create(
gpr_log(GPR_INFO, "Proxy address: %s", proxy->proxy_name);
// Create TCP server.
proxy->channel_args = grpc_channel_args_copy(args);
- grpc_error* error = grpc_tcp_server_create(
- &exec_ctx, nullptr, proxy->channel_args, &proxy->server);
+ grpc_error* error =
+ grpc_tcp_server_create(nullptr, proxy->channel_args, &proxy->server);
GPR_ASSERT(error == GRPC_ERROR_NONE);
// Bind to port.
grpc_resolved_address resolved_addr;
@@ -568,37 +545,35 @@ grpc_end2end_http_proxy* grpc_end2end_http_proxy_create(
// Start server.
proxy->pollset = (grpc_pollset*)gpr_zalloc(grpc_pollset_size());
grpc_pollset_init(proxy->pollset, &proxy->mu);
- grpc_tcp_server_start(&exec_ctx, proxy->server, &proxy->pollset, 1, on_accept,
- proxy);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_tcp_server_start(proxy->server, &proxy->pollset, 1, on_accept, proxy);
+
// Start proxy thread.
gpr_thd_options opt = gpr_thd_options_default();
gpr_thd_options_set_joinable(&opt);
- GPR_ASSERT(gpr_thd_new(&proxy->thd, thread_main, proxy, &opt));
+ GPR_ASSERT(
+ gpr_thd_new(&proxy->thd, "grpc_http_proxy", thread_main, proxy, &opt));
return proxy;
}
-static void destroy_pollset(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error) {
+static void destroy_pollset(void* arg, grpc_error* error) {
grpc_pollset* pollset = (grpc_pollset*)arg;
- grpc_pollset_destroy(exec_ctx, pollset);
+ grpc_pollset_destroy(pollset);
gpr_free(pollset);
}
void grpc_end2end_http_proxy_destroy(grpc_end2end_http_proxy* proxy) {
gpr_unref(&proxy->users); // Signal proxy thread to shutdown.
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_core::ExecCtx exec_ctx;
gpr_thd_join(proxy->thd);
- grpc_tcp_server_shutdown_listeners(&exec_ctx, proxy->server);
- grpc_tcp_server_unref(&exec_ctx, proxy->server);
+ grpc_tcp_server_shutdown_listeners(proxy->server);
+ grpc_tcp_server_unref(proxy->server);
gpr_free(proxy->proxy_name);
- grpc_channel_args_destroy(&exec_ctx, proxy->channel_args);
- grpc_pollset_shutdown(&exec_ctx, proxy->pollset,
+ grpc_channel_args_destroy(proxy->channel_args);
+ grpc_pollset_shutdown(proxy->pollset,
GRPC_CLOSURE_CREATE(destroy_pollset, proxy->pollset,
grpc_schedule_on_exec_ctx));
- GRPC_COMBINER_UNREF(&exec_ctx, proxy->combiner, "test");
+ GRPC_COMBINER_UNREF(proxy->combiner, "test");
gpr_free(proxy);
- grpc_exec_ctx_finish(&exec_ctx);
}
const char* grpc_end2end_http_proxy_get_proxy_name(
diff --git a/test/core/end2end/fixtures/proxy.cc b/test/core/end2end/fixtures/proxy.cc
index 2fab62b721..b1698c804c 100644
--- a/test/core/end2end/fixtures/proxy.cc
+++ b/test/core/end2end/fixtures/proxy.cc
@@ -98,7 +98,8 @@ grpc_end2end_proxy* grpc_end2end_proxy_create(const grpc_end2end_proxy_def* def,
grpc_call_details_init(&proxy->new_call_details);
gpr_thd_options_set_joinable(&opt);
- GPR_ASSERT(gpr_thd_new(&proxy->thd, thread_main, proxy, &opt));
+ GPR_ASSERT(
+ gpr_thd_new(&proxy->thd, "grpc_end2end_proxy", thread_main, proxy, &opt));
request_call(proxy);