aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core/http
diff options
context:
space:
mode:
authorGravatar David Garcia Quintas <dgq@google.com>2016-05-04 20:20:04 -0700
committerGravatar David Garcia Quintas <dgq@google.com>2016-05-04 20:20:04 -0700
commit604490973b219aa69ee67c252173fa60cadb24b1 (patch)
treeed9687ef20163c61a33ba47cff16948c559f96c8 /test/core/http
parent261db111e638da413ce3f7e933571cfbe02874c2 (diff)
allocate grpc_pops on the stack
Diffstat (limited to 'test/core/http')
-rw-r--r--test/core/http/httpcli_test.c19
-rw-r--r--test/core/http/httpscli_test.c19
2 files changed, 18 insertions, 20 deletions
diff --git a/test/core/http/httpcli_test.c b/test/core/http/httpcli_test.c
index 6b9ec7fd94..e517e37102 100644
--- a/test/core/http/httpcli_test.c
+++ b/test/core/http/httpcli_test.c
@@ -48,7 +48,7 @@
static int g_done = 0;
static grpc_httpcli_context g_context;
static gpr_mu *g_mu;
-static grpc_pops *g_pops;
+static grpc_pops g_pops;
static gpr_timespec n_seconds_time(int seconds) {
return GRPC_TIMEOUT_SECONDS_TO_DEADLINE(seconds);
@@ -66,7 +66,7 @@ static void on_finish(grpc_exec_ctx *exec_ctx, void *arg,
GPR_ASSERT(0 == memcmp(expect, response->body, response->body_length));
gpr_mu_lock(g_mu);
g_done = 1;
- grpc_pollset_kick(grpc_pops_pollset(g_pops), NULL);
+ grpc_pollset_kick(grpc_pops_pollset(&g_pops), NULL);
gpr_mu_unlock(g_mu);
}
@@ -86,12 +86,12 @@ static void test_get(int port) {
req.http.path = "/get";
req.handshaker = &grpc_httpcli_plaintext;
- grpc_httpcli_get(&exec_ctx, &g_context, g_pops, &req, n_seconds_time(15),
+ grpc_httpcli_get(&exec_ctx, &g_context, &g_pops, &req, n_seconds_time(15),
on_finish, (void *)42);
gpr_mu_lock(g_mu);
while (!g_done) {
grpc_pollset_worker *worker = NULL;
- grpc_pollset_work(&exec_ctx, grpc_pops_pollset(g_pops), &worker,
+ grpc_pollset_work(&exec_ctx, grpc_pops_pollset(&g_pops), &worker,
gpr_now(GPR_CLOCK_MONOTONIC), n_seconds_time(20));
gpr_mu_unlock(g_mu);
grpc_exec_ctx_finish(&exec_ctx);
@@ -117,12 +117,12 @@ static void test_post(int port) {
req.http.path = "/post";
req.handshaker = &grpc_httpcli_plaintext;
- grpc_httpcli_post(&exec_ctx, &g_context, g_pops, &req, "hello", 5,
+ grpc_httpcli_post(&exec_ctx, &g_context, &g_pops, &req, "hello", 5,
n_seconds_time(15), on_finish, (void *)42);
gpr_mu_lock(g_mu);
while (!g_done) {
grpc_pollset_worker *worker = NULL;
- grpc_pollset_work(&exec_ctx, grpc_pops_pollset(g_pops), &worker,
+ grpc_pollset_work(&exec_ctx, grpc_pops_pollset(&g_pops), &worker,
gpr_now(GPR_CLOCK_MONOTONIC), n_seconds_time(20));
gpr_mu_unlock(g_mu);
grpc_exec_ctx_finish(&exec_ctx);
@@ -188,13 +188,12 @@ int main(int argc, char **argv) {
test_post(port);
grpc_httpcli_context_destroy(&g_context);
- grpc_closure_init(&destroyed, destroy_pops, g_pops);
- grpc_pollset_shutdown(&exec_ctx, grpc_pops_pollset(g_pops), &destroyed);
+ grpc_closure_init(&destroyed, destroy_pops, &g_pops);
+ grpc_pollset_shutdown(&exec_ctx, grpc_pops_pollset(&g_pops), &destroyed);
grpc_exec_ctx_finish(&exec_ctx);
grpc_shutdown();
- gpr_free(grpc_pops_pollset(g_pops));
- grpc_pops_destroy(g_pops);
+ gpr_free(grpc_pops_pollset(&g_pops));
gpr_subprocess_destroy(server);
diff --git a/test/core/http/httpscli_test.c b/test/core/http/httpscli_test.c
index ee2122e1c1..8943c492fb 100644
--- a/test/core/http/httpscli_test.c
+++ b/test/core/http/httpscli_test.c
@@ -48,7 +48,7 @@
static int g_done = 0;
static grpc_httpcli_context g_context;
static gpr_mu *g_mu;
-static grpc_pops *g_pops;
+static grpc_pops g_pops;
static gpr_timespec n_seconds_time(int seconds) {
return GRPC_TIMEOUT_SECONDS_TO_DEADLINE(seconds);
@@ -66,7 +66,7 @@ static void on_finish(grpc_exec_ctx *exec_ctx, void *arg,
GPR_ASSERT(0 == memcmp(expect, response->body, response->body_length));
gpr_mu_lock(g_mu);
g_done = 1;
- grpc_pollset_kick(grpc_pops_pollset(g_pops), NULL);
+ grpc_pollset_kick(grpc_pops_pollset(&g_pops), NULL);
gpr_mu_unlock(g_mu);
}
@@ -87,12 +87,12 @@ static void test_get(int port) {
req.http.path = "/get";
req.handshaker = &grpc_httpcli_ssl;
- grpc_httpcli_get(&exec_ctx, &g_context, g_pops, &req, n_seconds_time(15),
+ grpc_httpcli_get(&exec_ctx, &g_context, &g_pops, &req, n_seconds_time(15),
on_finish, (void *)42);
gpr_mu_lock(g_mu);
while (!g_done) {
grpc_pollset_worker *worker = NULL;
- grpc_pollset_work(&exec_ctx, grpc_pops_pollset(g_pops), &worker,
+ grpc_pollset_work(&exec_ctx, grpc_pops_pollset(&g_pops), &worker,
gpr_now(GPR_CLOCK_MONOTONIC), n_seconds_time(20));
gpr_mu_unlock(g_mu);
grpc_exec_ctx_finish(&exec_ctx);
@@ -119,12 +119,12 @@ static void test_post(int port) {
req.http.path = "/post";
req.handshaker = &grpc_httpcli_ssl;
- grpc_httpcli_post(&exec_ctx, &g_context, g_pops, &req, "hello", 5,
+ grpc_httpcli_post(&exec_ctx, &g_context, &g_pops, &req, "hello", 5,
n_seconds_time(15), on_finish, (void *)42);
gpr_mu_lock(g_mu);
while (!g_done) {
grpc_pollset_worker *worker = NULL;
- grpc_pollset_work(&exec_ctx, grpc_pops_pollset(g_pops), &worker,
+ grpc_pollset_work(&exec_ctx, grpc_pops_pollset(&g_pops), &worker,
gpr_now(GPR_CLOCK_MONOTONIC), n_seconds_time(20));
gpr_mu_unlock(g_mu);
grpc_exec_ctx_finish(&exec_ctx);
@@ -191,13 +191,12 @@ int main(int argc, char **argv) {
test_post(port);
grpc_httpcli_context_destroy(&g_context);
- grpc_closure_init(&destroyed, destroy_pops, g_pops);
- grpc_pollset_shutdown(&exec_ctx, grpc_pops_pollset(g_pops), &destroyed);
+ grpc_closure_init(&destroyed, destroy_pops, &g_pops);
+ grpc_pollset_shutdown(&exec_ctx, grpc_pops_pollset(&g_pops), &destroyed);
grpc_exec_ctx_finish(&exec_ctx);
grpc_shutdown();
- gpr_free(grpc_pops_pollset(g_pops));
- grpc_pops_destroy(g_pops);
+ gpr_free(grpc_pops_pollset(&g_pops));
gpr_subprocess_destroy(server);