aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core/security
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/security
parent261db111e638da413ce3f7e933571cfbe02874c2 (diff)
allocate grpc_pops on the stack
Diffstat (limited to 'test/core/security')
-rw-r--r--test/core/security/oauth2_utils.c13
-rw-r--r--test/core/security/print_google_default_creds_token.c11
2 files changed, 11 insertions, 13 deletions
diff --git a/test/core/security/oauth2_utils.c b/test/core/security/oauth2_utils.c
index 2580757837..b3fe738e97 100644
--- a/test/core/security/oauth2_utils.c
+++ b/test/core/security/oauth2_utils.c
@@ -46,7 +46,7 @@
typedef struct {
gpr_mu *mu;
- grpc_pops *pops;
+ grpc_pops pops;
int is_done;
char *token;
} oauth2_request;
@@ -70,7 +70,7 @@ static void on_oauth2_response(grpc_exec_ctx *exec_ctx, void *user_data,
gpr_mu_lock(request->mu);
request->is_done = 1;
request->token = token;
- grpc_pollset_kick(grpc_pops_pollset(request->pops), NULL);
+ grpc_pollset_kick(grpc_pops_pollset(&request->pops), NULL);
gpr_mu_unlock(request->mu);
}
@@ -90,23 +90,22 @@ char *grpc_test_fetch_oauth2_token_with_credentials(
grpc_closure_init(&do_nothing_closure, do_nothing, NULL);
grpc_call_credentials_get_request_metadata(
- &exec_ctx, creds, request.pops, null_ctx, on_oauth2_response, &request);
+ &exec_ctx, creds, &request.pops, null_ctx, on_oauth2_response, &request);
grpc_exec_ctx_finish(&exec_ctx);
gpr_mu_lock(request.mu);
while (!request.is_done) {
grpc_pollset_worker *worker = NULL;
- grpc_pollset_work(&exec_ctx, grpc_pops_pollset(request.pops), &worker,
+ grpc_pollset_work(&exec_ctx, grpc_pops_pollset(&request.pops), &worker,
gpr_now(GPR_CLOCK_MONOTONIC),
gpr_inf_future(GPR_CLOCK_MONOTONIC));
}
gpr_mu_unlock(request.mu);
- grpc_pollset_shutdown(&exec_ctx, grpc_pops_pollset(request.pops),
+ grpc_pollset_shutdown(&exec_ctx, grpc_pops_pollset(&request.pops),
&do_nothing_closure);
grpc_exec_ctx_finish(&exec_ctx);
- gpr_free(grpc_pops_pollset(request.pops));
- grpc_pops_destroy(request.pops);
+ gpr_free(grpc_pops_pollset(&request.pops));
return request.token;
}
diff --git a/test/core/security/print_google_default_creds_token.c b/test/core/security/print_google_default_creds_token.c
index 4f5038c045..79e2549803 100644
--- a/test/core/security/print_google_default_creds_token.c
+++ b/test/core/security/print_google_default_creds_token.c
@@ -47,7 +47,7 @@
typedef struct {
gpr_mu *mu;
- grpc_pops *pops;
+ grpc_pops pops;
int is_done;
} synchronizer;
@@ -66,7 +66,7 @@ static void on_metadata_response(grpc_exec_ctx *exec_ctx, void *user_data,
}
gpr_mu_lock(sync->mu);
sync->is_done = 1;
- grpc_pollset_kick(grpc_pops_pollset(sync->pops), NULL);
+ grpc_pollset_kick(grpc_pops_pollset(&sync->pops), NULL);
gpr_mu_unlock(sync->mu);
}
@@ -100,12 +100,12 @@ int main(int argc, char **argv) {
grpc_call_credentials_get_request_metadata(
&exec_ctx, ((grpc_composite_channel_credentials *)creds)->call_creds,
- sync.pops, context, on_metadata_response, &sync);
+ &sync.pops, context, on_metadata_response, &sync);
gpr_mu_lock(sync.mu);
while (!sync.is_done) {
grpc_pollset_worker *worker = NULL;
- grpc_pollset_work(&exec_ctx, grpc_pops_pollset(sync.pops), &worker,
+ grpc_pollset_work(&exec_ctx, grpc_pops_pollset(&sync.pops), &worker,
gpr_now(GPR_CLOCK_MONOTONIC),
gpr_inf_future(GPR_CLOCK_MONOTONIC));
gpr_mu_unlock(sync.mu);
@@ -117,8 +117,7 @@ int main(int argc, char **argv) {
grpc_exec_ctx_finish(&exec_ctx);
grpc_channel_credentials_release(creds);
- gpr_free(grpc_pops_pollset(sync.pops));
- grpc_pops_destroy(sync.pops);
+ gpr_free(grpc_pops_pollset(&sync.pops));
end:
gpr_cmdline_destroy(cl);