aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core/http
diff options
context:
space:
mode:
authorGravatar David Garcia Quintas <dgq@google.com>2016-05-03 18:28:09 -0700
committerGravatar David Garcia Quintas <dgq@google.com>2016-05-03 18:28:09 -0700
commitf72eb97b3640cb3f99336b34b707c853c6db6ac0 (patch)
tree90faf5420288fae668259328ae57da14dc0cb64e /test/core/http
parent12e111c6929a689f37fd18deebe5ca64a088094f (diff)
Introduced grpc_pops (pollset or pollset_set)
Diffstat (limited to 'test/core/http')
-rw-r--r--test/core/http/httpcli_test.c33
-rw-r--r--test/core/http/httpscli_test.c34
2 files changed, 32 insertions, 35 deletions
diff --git a/test/core/http/httpcli_test.c b/test/core/http/httpcli_test.c
index 36e43b8de8..6b9ec7fd94 100644
--- a/test/core/http/httpcli_test.c
+++ b/test/core/http/httpcli_test.c
@@ -48,8 +48,7 @@
static int g_done = 0;
static grpc_httpcli_context g_context;
static gpr_mu *g_mu;
-static grpc_pollset *g_pollset;
-static grpc_pollset_set *g_pollset_set;
+static grpc_pops *g_pops;
static gpr_timespec n_seconds_time(int seconds) {
return GRPC_TIMEOUT_SECONDS_TO_DEADLINE(seconds);
@@ -67,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(g_pollset, NULL);
+ grpc_pollset_kick(grpc_pops_pollset(g_pops), NULL);
gpr_mu_unlock(g_mu);
}
@@ -87,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_pollset_set, &req,
- n_seconds_time(15), on_finish, (void *)42);
+ 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, g_pollset, &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);
@@ -118,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_pollset_set, &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, g_pollset, &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);
@@ -133,8 +132,8 @@ static void test_post(int port) {
gpr_free(host);
}
-static void destroy_pollset(grpc_exec_ctx *exec_ctx, void *p, bool success) {
- grpc_pollset_destroy(p);
+static void destroy_pops(grpc_exec_ctx *exec_ctx, void *p, bool success) {
+ grpc_pollset_destroy(grpc_pops_pollset(p));
}
int main(int argc, char **argv) {
@@ -181,21 +180,21 @@ int main(int argc, char **argv) {
grpc_test_init(argc, argv);
grpc_init();
grpc_httpcli_context_init(&g_context);
- g_pollset = gpr_malloc(grpc_pollset_size());
- grpc_pollset_init(g_pollset, &g_mu);
- g_pollset_set = grpc_pollset_set_create();
- grpc_pollset_set_add_pollset(&exec_ctx, g_pollset_set, g_pollset);
+ grpc_pollset *pollset = gpr_malloc(grpc_pollset_size());
+ grpc_pollset_init(pollset, &g_mu);
+ g_pops = grpc_pops_create_from_pollset(pollset);
test_get(port);
test_post(port);
grpc_httpcli_context_destroy(&g_context);
- grpc_closure_init(&destroyed, destroy_pollset, g_pollset);
- grpc_pollset_shutdown(&exec_ctx, g_pollset, &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(g_pollset);
+ gpr_free(grpc_pops_pollset(g_pops));
+ grpc_pops_destroy(g_pops);
gpr_subprocess_destroy(server);
diff --git a/test/core/http/httpscli_test.c b/test/core/http/httpscli_test.c
index 1aeaf2cf10..ee2122e1c1 100644
--- a/test/core/http/httpscli_test.c
+++ b/test/core/http/httpscli_test.c
@@ -48,8 +48,7 @@
static int g_done = 0;
static grpc_httpcli_context g_context;
static gpr_mu *g_mu;
-static grpc_pollset *g_pollset;
-static grpc_pollset_set *g_pollset_set;
+static grpc_pops *g_pops;
static gpr_timespec n_seconds_time(int seconds) {
return GRPC_TIMEOUT_SECONDS_TO_DEADLINE(seconds);
@@ -67,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(g_pollset, NULL);
+ grpc_pollset_kick(grpc_pops_pollset(g_pops), NULL);
gpr_mu_unlock(g_mu);
}
@@ -88,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_pollset_set, &req,
- n_seconds_time(15), on_finish, (void *)42);
+ 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, g_pollset, &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);
@@ -120,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_pollset_set, &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, g_pollset, &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);
@@ -135,8 +134,8 @@ static void test_post(int port) {
gpr_free(host);
}
-static void destroy_pollset(grpc_exec_ctx *exec_ctx, void *p, bool success) {
- grpc_pollset_destroy(p);
+static void destroy_pops(grpc_exec_ctx *exec_ctx, void *p, bool success) {
+ grpc_pollset_destroy(grpc_pops_pollset(p));
}
int main(int argc, char **argv) {
@@ -184,22 +183,21 @@ int main(int argc, char **argv) {
grpc_test_init(argc, argv);
grpc_init();
grpc_httpcli_context_init(&g_context);
- g_pollset = gpr_malloc(grpc_pollset_size());
- grpc_pollset_init(g_pollset, &g_mu);
- g_pollset_set = grpc_pollset_set_create();
- grpc_pollset_set_add_pollset(&exec_ctx, g_pollset_set, g_pollset);
+ grpc_pollset *pollset = gpr_malloc(grpc_pollset_size());
+ grpc_pollset_init(pollset, &g_mu);
+ g_pops = grpc_pops_create_from_pollset(pollset);
test_get(port);
test_post(port);
grpc_httpcli_context_destroy(&g_context);
- grpc_closure_init(&destroyed, destroy_pollset, g_pollset);
- grpc_pollset_shutdown(&exec_ctx, g_pollset, &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_pollset_set_destroy(g_pollset_set);
grpc_shutdown();
- gpr_free(g_pollset);
+ gpr_free(grpc_pops_pollset(g_pops));
+ grpc_pops_destroy(g_pops);
gpr_subprocess_destroy(server);