clang-format

pull/6190/head
David Garcia Quintas 9 years ago
parent 1cf4ec7ad0
commit 69ff63d158
  1. 11
      src/core/ext/lb_policy/pick_first/pick_first.c
  2. 9
      src/core/ext/lb_policy/round_robin/round_robin.c
  3. 4
      src/core/lib/http/httpcli.c
  4. 14
      src/core/lib/iomgr/polling_entity.c
  5. 11
      src/core/lib/iomgr/polling_entity.h
  6. 7
      src/core/lib/security/credentials/google_default/google_default_credentials.c
  7. 6
      src/core/lib/surface/call.c
  8. 3
      test/core/http/httpcli_test.c
  9. 3
      test/core/http/httpscli_test.c
  10. 4
      test/core/security/oauth2_utils.c
  11. 4
      test/core/security/print_google_default_creds_token.c

@ -119,7 +119,7 @@ static void pf_shutdown(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol) {
pending_pick *next = pp->next; pending_pick *next = pp->next;
*pp->target = NULL; *pp->target = NULL;
grpc_polling_entity_del_from_pollset_set(exec_ctx, pp->pollent, grpc_polling_entity_del_from_pollset_set(exec_ctx, pp->pollent,
p->base.interested_parties); p->base.interested_parties);
grpc_exec_ctx_enqueue(exec_ctx, pp->on_complete, true, NULL); grpc_exec_ctx_enqueue(exec_ctx, pp->on_complete, true, NULL);
gpr_free(pp); gpr_free(pp);
pp = next; pp = next;
@ -137,7 +137,7 @@ static void pf_cancel_pick(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol,
pending_pick *next = pp->next; pending_pick *next = pp->next;
if (pp->target == target) { if (pp->target == target) {
grpc_polling_entity_del_from_pollset_set(exec_ctx, pp->pollent, grpc_polling_entity_del_from_pollset_set(exec_ctx, pp->pollent,
p->base.interested_parties); p->base.interested_parties);
*target = NULL; *target = NULL;
grpc_exec_ctx_enqueue(exec_ctx, pp->on_complete, false, NULL); grpc_exec_ctx_enqueue(exec_ctx, pp->on_complete, false, NULL);
gpr_free(pp); gpr_free(pp);
@ -163,7 +163,7 @@ static void pf_cancel_picks(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol,
if ((pp->initial_metadata_flags & initial_metadata_flags_mask) == if ((pp->initial_metadata_flags & initial_metadata_flags_mask) ==
initial_metadata_flags_eq) { initial_metadata_flags_eq) {
grpc_polling_entity_del_from_pollset_set(exec_ctx, pp->pollent, grpc_polling_entity_del_from_pollset_set(exec_ctx, pp->pollent,
p->base.interested_parties); p->base.interested_parties);
grpc_exec_ctx_enqueue(exec_ctx, pp->on_complete, false, NULL); grpc_exec_ctx_enqueue(exec_ctx, pp->on_complete, false, NULL);
gpr_free(pp); gpr_free(pp);
} else { } else {
@ -222,7 +222,8 @@ static int pf_pick(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol,
if (!p->started_picking) { if (!p->started_picking) {
start_picking(exec_ctx, p); start_picking(exec_ctx, p);
} }
grpc_polling_entity_add_to_pollset_set(exec_ctx, pollent, p->base.interested_parties); grpc_polling_entity_add_to_pollset_set(exec_ctx, pollent,
p->base.interested_parties);
pp = gpr_malloc(sizeof(*pp)); pp = gpr_malloc(sizeof(*pp));
pp->next = p->pending_picks; pp->next = p->pending_picks;
pp->pollent = pollent; pp->pollent = pollent;
@ -306,7 +307,7 @@ static void pf_connectivity_changed(grpc_exec_ctx *exec_ctx, void *arg,
p->pending_picks = pp->next; p->pending_picks = pp->next;
*pp->target = selected; *pp->target = selected;
grpc_polling_entity_del_from_pollset_set(exec_ctx, pp->pollent, grpc_polling_entity_del_from_pollset_set(exec_ctx, pp->pollent,
p->base.interested_parties); p->base.interested_parties);
grpc_exec_ctx_enqueue(exec_ctx, pp->on_complete, true, NULL); grpc_exec_ctx_enqueue(exec_ctx, pp->on_complete, true, NULL);
gpr_free(pp); gpr_free(pp);
} }

@ -263,7 +263,7 @@ static void rr_cancel_pick(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol,
pending_pick *next = pp->next; pending_pick *next = pp->next;
if (pp->target == target) { if (pp->target == target) {
grpc_polling_entity_del_from_pollset_set(exec_ctx, pp->pollent, grpc_polling_entity_del_from_pollset_set(exec_ctx, pp->pollent,
p->base.interested_parties); p->base.interested_parties);
*target = NULL; *target = NULL;
grpc_exec_ctx_enqueue(exec_ctx, pp->on_complete, false, NULL); grpc_exec_ctx_enqueue(exec_ctx, pp->on_complete, false, NULL);
gpr_free(pp); gpr_free(pp);
@ -289,7 +289,7 @@ static void rr_cancel_picks(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol,
if ((pp->initial_metadata_flags & initial_metadata_flags_mask) == if ((pp->initial_metadata_flags & initial_metadata_flags_mask) ==
initial_metadata_flags_eq) { initial_metadata_flags_eq) {
grpc_polling_entity_del_from_pollset_set(exec_ctx, pp->pollent, grpc_polling_entity_del_from_pollset_set(exec_ctx, pp->pollent,
p->base.interested_parties); p->base.interested_parties);
*pp->target = NULL; *pp->target = NULL;
grpc_exec_ctx_enqueue(exec_ctx, pp->on_complete, false, NULL); grpc_exec_ctx_enqueue(exec_ctx, pp->on_complete, false, NULL);
gpr_free(pp); gpr_free(pp);
@ -355,7 +355,8 @@ static int rr_pick(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol,
if (!p->started_picking) { if (!p->started_picking) {
start_picking(exec_ctx, p); start_picking(exec_ctx, p);
} }
grpc_polling_entity_add_to_pollset_set(exec_ctx, pollent, p->base.interested_parties); grpc_polling_entity_add_to_pollset_set(exec_ctx, pollent,
p->base.interested_parties);
pp = gpr_malloc(sizeof(*pp)); pp = gpr_malloc(sizeof(*pp));
pp->next = p->pending_picks; pp->next = p->pending_picks;
pp->pollent = pollent; pp->pollent = pollent;
@ -408,7 +409,7 @@ static void rr_connectivity_changed(grpc_exec_ctx *exec_ctx, void *arg,
selected->subchannel, selected); selected->subchannel, selected);
} }
grpc_polling_entity_del_from_pollset_set(exec_ctx, pp->pollent, grpc_polling_entity_del_from_pollset_set(exec_ctx, pp->pollent,
p->base.interested_parties); p->base.interested_parties);
grpc_exec_ctx_enqueue(exec_ctx, pp->on_complete, true, NULL); grpc_exec_ctx_enqueue(exec_ctx, pp->on_complete, true, NULL);
gpr_free(pp); gpr_free(pp);
} }

@ -98,7 +98,7 @@ static void next_address(grpc_exec_ctx *exec_ctx, internal_request *req);
static void finish(grpc_exec_ctx *exec_ctx, internal_request *req, static void finish(grpc_exec_ctx *exec_ctx, internal_request *req,
int success) { int success) {
grpc_polling_entity_del_from_pollset_set(exec_ctx, req->pollent, grpc_polling_entity_del_from_pollset_set(exec_ctx, req->pollent,
req->context->pollset_set); req->context->pollset_set);
req->on_response(exec_ctx, req->user_data, req->on_response(exec_ctx, req->user_data,
success ? &req->parser.http.response : NULL); success ? &req->parser.http.response : NULL);
grpc_http_parser_destroy(&req->parser); grpc_http_parser_destroy(&req->parser);
@ -246,7 +246,7 @@ static void internal_request_begin(
GPR_ASSERT(pollent); GPR_ASSERT(pollent);
grpc_polling_entity_add_to_pollset_set(exec_ctx, req->pollent, grpc_polling_entity_add_to_pollset_set(exec_ctx, req->pollent,
req->context->pollset_set); req->context->pollset_set);
grpc_resolve_address(exec_ctx, request->host, req->handshaker->default_port, grpc_resolve_address(exec_ctx, request->host, req->handshaker->default_port,
on_resolved, req); on_resolved, req);
} }

@ -44,7 +44,8 @@ grpc_polling_entity grpc_polling_entity_create_from_pollset_set(
return pollent; return pollent;
} }
grpc_polling_entity grpc_polling_entity_create_from_pollset(grpc_pollset *pollset) { grpc_polling_entity grpc_polling_entity_create_from_pollset(
grpc_pollset *pollset) {
grpc_polling_entity pollent; grpc_polling_entity pollent;
pollent.pollent.pollset = pollset; pollent.pollent.pollset = pollset;
pollent.tag = POPS_POLLSET; pollent.tag = POPS_POLLSET;
@ -58,7 +59,8 @@ grpc_pollset *grpc_polling_entity_pollset(grpc_polling_entity *pollent) {
return NULL; return NULL;
} }
grpc_pollset_set *grpc_polling_entity_pollset_set(grpc_polling_entity *pollent) { grpc_pollset_set *grpc_polling_entity_pollset_set(
grpc_polling_entity *pollent) {
if (pollent->tag == POPS_POLLSET_SET) { if (pollent->tag == POPS_POLLSET_SET) {
return pollent->pollent.pollset_set; return pollent->pollent.pollset_set;
} }
@ -70,8 +72,8 @@ bool grpc_polling_entity_is_empty(const grpc_polling_entity *pollent) {
} }
void grpc_polling_entity_add_to_pollset_set(grpc_exec_ctx *exec_ctx, void grpc_polling_entity_add_to_pollset_set(grpc_exec_ctx *exec_ctx,
grpc_polling_entity *pollent, grpc_polling_entity *pollent,
grpc_pollset_set *pss_dst) { grpc_pollset_set *pss_dst) {
if (pollent->tag == POPS_POLLSET) { if (pollent->tag == POPS_POLLSET) {
GPR_ASSERT(pollent->pollent.pollset != NULL); GPR_ASSERT(pollent->pollent.pollset != NULL);
grpc_pollset_set_add_pollset(exec_ctx, pss_dst, pollent->pollent.pollset); grpc_pollset_set_add_pollset(exec_ctx, pss_dst, pollent->pollent.pollset);
@ -86,8 +88,8 @@ void grpc_polling_entity_add_to_pollset_set(grpc_exec_ctx *exec_ctx,
} }
void grpc_polling_entity_del_from_pollset_set(grpc_exec_ctx *exec_ctx, void grpc_polling_entity_del_from_pollset_set(grpc_exec_ctx *exec_ctx,
grpc_polling_entity *pollent, grpc_polling_entity *pollent,
grpc_pollset_set *pss_dst) { grpc_pollset_set *pss_dst) {
if (pollent->tag == POPS_POLLSET) { if (pollent->tag == POPS_POLLSET) {
GPR_ASSERT(pollent->pollent.pollset != NULL); GPR_ASSERT(pollent->pollent.pollset != NULL);
grpc_pollset_set_del_pollset(exec_ctx, pss_dst, pollent->pollent.pollset); grpc_pollset_set_del_pollset(exec_ctx, pss_dst, pollent->pollent.pollset);

@ -52,7 +52,8 @@ typedef struct grpc_polling_entity {
grpc_polling_entity grpc_polling_entity_create_from_pollset_set( grpc_polling_entity grpc_polling_entity_create_from_pollset_set(
grpc_pollset_set *pollset_set); grpc_pollset_set *pollset_set);
grpc_polling_entity grpc_polling_entity_create_from_pollset(grpc_pollset *pollset); grpc_polling_entity grpc_polling_entity_create_from_pollset(
grpc_pollset *pollset);
/** If \a pollent contains a pollset, return it. Otherwise, return NULL */ /** If \a pollent contains a pollset, return it. Otherwise, return NULL */
grpc_pollset *grpc_polling_entity_pollset(grpc_polling_entity *pollent); grpc_pollset *grpc_polling_entity_pollset(grpc_polling_entity *pollent);
@ -66,15 +67,15 @@ bool grpc_polling_entity_is_empty(const grpc_polling_entity *pollent);
* \a * \a
* pss_dst */ * pss_dst */
void grpc_polling_entity_add_to_pollset_set(grpc_exec_ctx *exec_ctx, void grpc_polling_entity_add_to_pollset_set(grpc_exec_ctx *exec_ctx,
grpc_polling_entity *pollent, grpc_polling_entity *pollent,
grpc_pollset_set *pss_dst); grpc_pollset_set *pss_dst);
/** Delete the pollset or pollset_set in \a pollent from the destination /** Delete the pollset or pollset_set in \a pollent from the destination
* pollset_set \a * pollset_set \a
* pss_dst */ * pss_dst */
void grpc_polling_entity_del_from_pollset_set(grpc_exec_ctx *exec_ctx, void grpc_polling_entity_del_from_pollset_set(grpc_exec_ctx *exec_ctx,
grpc_polling_entity *pollent, grpc_polling_entity *pollent,
grpc_pollset_set *pss_dst); grpc_pollset_set *pss_dst);
/* pollset_set specific */ /* pollset_set specific */
#endif /* GRPC_CORE_LIB_IOMGR_POLLING_ENTITY_H */ #endif /* GRPC_CORE_LIB_IOMGR_POLLING_ENTITY_H */

@ -130,8 +130,8 @@ static int is_stack_running_on_compute_engine(void) {
gpr_mu_lock(g_polling_mu); gpr_mu_lock(g_polling_mu);
while (!detector.is_done) { while (!detector.is_done) {
grpc_pollset_worker *worker = NULL; grpc_pollset_worker *worker = NULL;
grpc_pollset_work(&exec_ctx, grpc_polling_entity_pollset(&detector.pollent), &worker, grpc_pollset_work(&exec_ctx, grpc_polling_entity_pollset(&detector.pollent),
gpr_now(GPR_CLOCK_MONOTONIC), &worker, gpr_now(GPR_CLOCK_MONOTONIC),
gpr_inf_future(GPR_CLOCK_MONOTONIC)); gpr_inf_future(GPR_CLOCK_MONOTONIC));
} }
gpr_mu_unlock(g_polling_mu); gpr_mu_unlock(g_polling_mu);
@ -139,7 +139,8 @@ static int is_stack_running_on_compute_engine(void) {
grpc_httpcli_context_destroy(&context); grpc_httpcli_context_destroy(&context);
grpc_closure_init(&destroy_closure, destroy_pollset, grpc_closure_init(&destroy_closure, destroy_pollset,
grpc_polling_entity_pollset(&detector.pollent)); grpc_polling_entity_pollset(&detector.pollent));
grpc_pollset_shutdown(&exec_ctx, grpc_polling_entity_pollset(&detector.pollent), grpc_pollset_shutdown(&exec_ctx,
grpc_polling_entity_pollset(&detector.pollent),
&destroy_closure); &destroy_closure);
grpc_exec_ctx_finish(&exec_ctx); grpc_exec_ctx_finish(&exec_ctx);
g_polling_mu = NULL; g_polling_mu = NULL;

@ -264,10 +264,12 @@ grpc_call *grpc_call_create(
pollset_set_alternative == NULL && pollset_set_alternative == NULL &&
"Only one of 'cq' and 'pollset_set_alternative' should be non-NULL."); "Only one of 'cq' and 'pollset_set_alternative' should be non-NULL.");
GRPC_CQ_INTERNAL_REF(cq, "bind"); GRPC_CQ_INTERNAL_REF(cq, "bind");
call->pollent = grpc_polling_entity_create_from_pollset(grpc_cq_pollset(cq)); call->pollent =
grpc_polling_entity_create_from_pollset(grpc_cq_pollset(cq));
} }
if (pollset_set_alternative != NULL) { if (pollset_set_alternative != NULL) {
call->pollent = grpc_polling_entity_create_from_pollset_set(pollset_set_alternative); call->pollent =
grpc_polling_entity_create_from_pollset_set(pollset_set_alternative);
} }
if (!grpc_polling_entity_is_empty(&call->pollent)) { if (!grpc_polling_entity_is_empty(&call->pollent)) {
grpc_call_stack_set_pollset_or_pollset_set( grpc_call_stack_set_pollset_or_pollset_set(

@ -189,7 +189,8 @@ int main(int argc, char **argv) {
grpc_httpcli_context_destroy(&g_context); grpc_httpcli_context_destroy(&g_context);
grpc_closure_init(&destroyed, destroy_pops, &g_pops); grpc_closure_init(&destroyed, destroy_pops, &g_pops);
grpc_pollset_shutdown(&exec_ctx, grpc_polling_entity_pollset(&g_pops), &destroyed); grpc_pollset_shutdown(&exec_ctx, grpc_polling_entity_pollset(&g_pops),
&destroyed);
grpc_exec_ctx_finish(&exec_ctx); grpc_exec_ctx_finish(&exec_ctx);
grpc_shutdown(); grpc_shutdown();

@ -192,7 +192,8 @@ int main(int argc, char **argv) {
grpc_httpcli_context_destroy(&g_context); grpc_httpcli_context_destroy(&g_context);
grpc_closure_init(&destroyed, destroy_pops, &g_pops); grpc_closure_init(&destroyed, destroy_pops, &g_pops);
grpc_pollset_shutdown(&exec_ctx, grpc_polling_entity_pollset(&g_pops), &destroyed); grpc_pollset_shutdown(&exec_ctx, grpc_polling_entity_pollset(&g_pops),
&destroyed);
grpc_exec_ctx_finish(&exec_ctx); grpc_exec_ctx_finish(&exec_ctx);
grpc_shutdown(); grpc_shutdown();

@ -98,8 +98,8 @@ char *grpc_test_fetch_oauth2_token_with_credentials(
gpr_mu_lock(request.mu); gpr_mu_lock(request.mu);
while (!request.is_done) { while (!request.is_done) {
grpc_pollset_worker *worker = NULL; grpc_pollset_worker *worker = NULL;
grpc_pollset_work(&exec_ctx, grpc_polling_entity_pollset(&request.pops), &worker, grpc_pollset_work(&exec_ctx, grpc_polling_entity_pollset(&request.pops),
gpr_now(GPR_CLOCK_MONOTONIC), &worker, gpr_now(GPR_CLOCK_MONOTONIC),
gpr_inf_future(GPR_CLOCK_MONOTONIC)); gpr_inf_future(GPR_CLOCK_MONOTONIC));
} }
gpr_mu_unlock(request.mu); gpr_mu_unlock(request.mu);

@ -106,8 +106,8 @@ int main(int argc, char **argv) {
gpr_mu_lock(sync.mu); gpr_mu_lock(sync.mu);
while (!sync.is_done) { while (!sync.is_done) {
grpc_pollset_worker *worker = NULL; grpc_pollset_worker *worker = NULL;
grpc_pollset_work(&exec_ctx, grpc_polling_entity_pollset(&sync.pops), &worker, grpc_pollset_work(&exec_ctx, grpc_polling_entity_pollset(&sync.pops),
gpr_now(GPR_CLOCK_MONOTONIC), &worker, gpr_now(GPR_CLOCK_MONOTONIC),
gpr_inf_future(GPR_CLOCK_MONOTONIC)); gpr_inf_future(GPR_CLOCK_MONOTONIC));
gpr_mu_unlock(sync.mu); gpr_mu_unlock(sync.mu);
grpc_exec_ctx_flush(&exec_ctx); grpc_exec_ctx_flush(&exec_ctx);

Loading…
Cancel
Save