Remove pollent from dns_next's args

reviewable/pr7771/r1
Yuchen Zeng 8 years ago
parent c007a6c879
commit 0b4c4fc537
  1. 10
      src/core/ext/client_config/client_channel.c
  2. 3
      src/core/ext/client_config/resolver.c
  3. 4
      src/core/ext/client_config/resolver.h
  4. 17
      src/core/ext/resolver/dns/c_ares/dns_resolver_ares.c
  5. 2
      src/core/ext/resolver/dns/c_ares/grpc_ares_wrapper.c
  6. 5
      src/core/ext/resolver/dns/c_ares/grpc_ares_wrapper.h
  7. 2
      src/core/ext/resolver/dns/c_ares/grpc_ares_wrapper_fallback.c
  8. 2
      src/core/ext/resolver/dns/native/dns_resolver.c
  9. 2
      src/core/ext/resolver/sockaddr/sockaddr_resolver.c
  10. 4
      test/core/client_config/resolvers/dns_resolver_connectivity_test.c
  11. 2
      test/core/client_config/resolvers/sockaddr_resolver_test.c
  12. 1
      test/core/end2end/fake_resolver.c

@ -255,7 +255,7 @@ static void on_resolver_result_changed(grpc_exec_ctx *exec_ctx, void *arg,
watch_lb_policy(exec_ctx, chand, lb_policy, state);
}
GRPC_CHANNEL_STACK_REF(chand->owning_stack, "resolver");
grpc_resolver_next(exec_ctx, chand->resolver, NULL, &chand->resolver_result,
grpc_resolver_next(exec_ctx, chand->resolver, &chand->resolver_result,
&chand->on_resolver_result_changed);
gpr_mu_unlock(&chand->mu);
} else {
@ -647,8 +647,7 @@ static bool pick_subchannel(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
if (chand->resolver != NULL && !chand->started_resolving) {
chand->started_resolving = true;
GRPC_CHANNEL_STACK_REF(chand->owning_stack, "resolver");
grpc_resolver_next(exec_ctx, chand->resolver, calld->pollent,
&chand->resolver_result,
grpc_resolver_next(exec_ctx, chand->resolver, &chand->resolver_result,
&chand->on_resolver_result_changed);
}
if (chand->resolver != NULL) {
@ -862,6 +861,8 @@ void grpc_client_channel_finish_initialization(
gpr_mu_lock(&chand->mu);
GPR_ASSERT(!chand->resolver);
chand->resolver = resolver;
grpc_pollset_set_add_pollset_set(exec_ctx, resolver->pollset_set,
chand->interested_parties);
GRPC_RESOLVER_REF(resolver, "channel");
GPR_ASSERT(grpc_closure_list_empty(chand->waiting_for_config_closures));
@ -886,8 +887,7 @@ grpc_connectivity_state grpc_client_channel_check_connectivity_state(
if (!chand->started_resolving && chand->resolver != NULL) {
GRPC_CHANNEL_STACK_REF(chand->owning_stack, "resolver");
chand->started_resolving = true;
grpc_resolver_next(exec_ctx, chand->resolver, NULL,
&chand->resolver_result,
grpc_resolver_next(exec_ctx, chand->resolver, &chand->resolver_result,
&chand->on_resolver_result_changed);
}
}

@ -78,8 +78,7 @@ void grpc_resolver_channel_saw_error(grpc_exec_ctx *exec_ctx,
}
void grpc_resolver_next(grpc_exec_ctx *exec_ctx, grpc_resolver *resolver,
grpc_polling_entity *pollent,
grpc_resolver_result **result,
grpc_closure *on_complete) {
resolver->vtable->next(exec_ctx, resolver, pollent, result, on_complete);
resolver->vtable->next(exec_ctx, resolver, result, on_complete);
}

@ -54,8 +54,7 @@ struct grpc_resolver_vtable {
void (*shutdown)(grpc_exec_ctx *exec_ctx, grpc_resolver *resolver);
void (*channel_saw_error)(grpc_exec_ctx *exec_ctx, grpc_resolver *resolver);
void (*next)(grpc_exec_ctx *exec_ctx, grpc_resolver *resolver,
grpc_polling_entity *pollent, grpc_resolver_result **result,
grpc_closure *on_complete);
grpc_resolver_result **result, grpc_closure *on_complete);
};
#ifdef GRPC_RESOLVER_REFCOUNT_DEBUG
@ -90,7 +89,6 @@ void grpc_resolver_channel_saw_error(grpc_exec_ctx *exec_ctx,
If resolution is fatally broken, set *result to NULL and
schedule on_complete. */
void grpc_resolver_next(grpc_exec_ctx *exec_ctx, grpc_resolver *resolver,
grpc_polling_entity *pollent,
grpc_resolver_result **result,
grpc_closure *on_complete);

@ -84,8 +84,6 @@ typedef struct {
/** currently resolving addresses */
grpc_resolved_addresses *addresses;
grpc_polling_entity *pollent;
} dns_resolver;
static void dns_ares_destroy(grpc_exec_ctx *exec_ctx, grpc_resolver *r);
@ -99,7 +97,6 @@ static void dns_ares_shutdown(grpc_exec_ctx *exec_ctx, grpc_resolver *r);
static void dns_ares_channel_saw_error(grpc_exec_ctx *exec_ctx,
grpc_resolver *r);
static void dns_ares_next(grpc_exec_ctx *exec_ctx, grpc_resolver *r,
grpc_polling_entity *pollent,
grpc_resolver_result **target_result,
grpc_closure *on_complete);
@ -167,11 +164,6 @@ static void dns_ares_on_resolved(grpc_exec_ctx *exec_ctx, void *arg,
grpc_resolved_addresses_destroy(r->addresses);
result = grpc_resolver_result_create(r->target_name, addresses,
NULL /* lb_policy_name */, NULL);
if (r->pollent) {
grpc_polling_entity_del_from_pollset_set(exec_ctx, r->pollent,
r->base.pollset_set);
r->pollent = NULL;
}
} else {
gpr_timespec now = gpr_now(GPR_CLOCK_MONOTONIC);
gpr_timespec next_try = gpr_backoff_step(&r->backoff_state, now);
@ -202,7 +194,6 @@ static void dns_ares_on_resolved(grpc_exec_ctx *exec_ctx, void *arg,
}
static void dns_ares_next(grpc_exec_ctx *exec_ctx, grpc_resolver *resolver,
grpc_polling_entity *pollent,
grpc_resolver_result **target_result,
grpc_closure *on_complete) {
dns_resolver *r = (dns_resolver *)resolver;
@ -216,14 +207,6 @@ static void dns_ares_next(grpc_exec_ctx *exec_ctx, grpc_resolver *resolver,
GPR_ASSERT(!r->resolving);
r->resolving = true;
r->addresses = NULL;
r->pollent = NULL;
if (grpc_ares_need_poll_entity() && pollent) {
r->pollent = pollent;
grpc_polling_entity_add_to_pollset_set(exec_ctx, pollent,
r->base.pollset_set);
} else {
gpr_log(GPR_DEBUG, "dns_ares_next is called without giving a pollent");
}
grpc_resolve_address_ares(
exec_ctx, r->name_to_resolve, r->default_port, r->base.pollset_set,
grpc_closure_create(dns_ares_on_resolved, r), &r->addresses);

@ -307,6 +307,4 @@ void grpc_ares_cleanup(void) {
gpr_mu_unlock(&g_init_mu);
}
bool grpc_ares_need_poll_entity(void) { return true; }
#endif /* GRPC_NATIVE_ADDRESS_RESOLVE */

@ -61,9 +61,4 @@ grpc_error *grpc_ares_init(void);
wrapper. */
void grpc_ares_cleanup(void);
/* Returns true if the gRPC ares wrapper implementation needs a polling entity,
false otherwise. */
/* TODO(zyc): remove this temporary hack after we can build c-ares on windows */
bool grpc_ares_need_poll_entity(void);
#endif /* GRPC_CORE_EXT_RESOLVER_DNS_C_ARES_GRPC_ARES_WRAPPER_H */

@ -55,6 +55,4 @@ grpc_error *grpc_ares_init(void) { return GRPC_ERROR_NONE; }
void grpc_ares_cleanup(void) {}
bool grpc_ares_need_poll_entity(void) { return false; }
#endif /* GRPC_NATIVE_ADDRESS_RESOLVE */

@ -94,7 +94,6 @@ static void dns_maybe_finish_next_locked(grpc_exec_ctx *exec_ctx,
static void dns_shutdown(grpc_exec_ctx *exec_ctx, grpc_resolver *r);
static void dns_channel_saw_error(grpc_exec_ctx *exec_ctx, grpc_resolver *r);
static void dns_next(grpc_exec_ctx *exec_ctx, grpc_resolver *r,
grpc_polling_entity *pollent,
grpc_resolver_result **target_result,
grpc_closure *on_complete);
@ -128,7 +127,6 @@ static void dns_channel_saw_error(grpc_exec_ctx *exec_ctx,
}
static void dns_next(grpc_exec_ctx *exec_ctx, grpc_resolver *resolver,
grpc_polling_entity *pollent,
grpc_resolver_result **target_result,
grpc_closure *on_complete) {
dns_resolver *r = (dns_resolver *)resolver;

@ -72,7 +72,6 @@ static void sockaddr_shutdown(grpc_exec_ctx *exec_ctx, grpc_resolver *r);
static void sockaddr_channel_saw_error(grpc_exec_ctx *exec_ctx,
grpc_resolver *r);
static void sockaddr_next(grpc_exec_ctx *exec_ctx, grpc_resolver *r,
grpc_polling_entity *pollent,
grpc_resolver_result **target_result,
grpc_closure *on_complete);
@ -102,7 +101,6 @@ static void sockaddr_channel_saw_error(grpc_exec_ctx *exec_ctx,
}
static void sockaddr_next(grpc_exec_ctx *exec_ctx, grpc_resolver *resolver,
grpc_polling_entity *pollent,
grpc_resolver_result **target_result,
grpc_closure *on_complete) {
sockaddr_resolver *r = (sockaddr_resolver *)resolver;

@ -110,7 +110,7 @@ int main(int argc, char **argv) {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
gpr_event ev1;
gpr_event_init(&ev1);
grpc_resolver_next(&exec_ctx, resolver, NULL, &result,
grpc_resolver_next(&exec_ctx, resolver, &result,
grpc_closure_create(on_done, &ev1));
grpc_exec_ctx_flush(&exec_ctx);
GPR_ASSERT(wait_loop(5, &ev1));
@ -118,7 +118,7 @@ int main(int argc, char **argv) {
gpr_event ev2;
gpr_event_init(&ev2);
grpc_resolver_next(&exec_ctx, resolver, NULL, &result,
grpc_resolver_next(&exec_ctx, resolver, &result,
grpc_closure_create(on_done, &ev2));
grpc_exec_ctx_flush(&exec_ctx);
GPR_ASSERT(wait_loop(30, &ev2));

@ -74,7 +74,7 @@ static void test_succeeds(grpc_resolver_factory *factory, const char *string) {
grpc_closure *on_resolution =
grpc_closure_create(on_resolution_cb, &on_res_arg);
grpc_resolver_next(&exec_ctx, resolver, NULL, &on_res_arg.resolver_result,
grpc_resolver_next(&exec_ctx, resolver, &on_res_arg.resolver_result,
on_resolution);
GRPC_RESOLVER_UNREF(&exec_ctx, resolver, "test_succeeds");
grpc_exec_ctx_finish(&exec_ctx);

@ -116,7 +116,6 @@ static void fake_resolver_channel_saw_error(grpc_exec_ctx* exec_ctx,
}
static void fake_resolver_next(grpc_exec_ctx* exec_ctx, grpc_resolver* resolver,
grpc_polling_entity* pollent,
grpc_resolver_result** target_result,
grpc_closure* on_complete) {
fake_resolver* r = (fake_resolver*)resolver;

Loading…
Cancel
Save