diff --git a/src/core/ext/client_config/client_channel.c b/src/core/ext/client_config/client_channel.c index d627cee68e4..2d3fc0dfb2d 100644 --- a/src/core/ext/client_config/client_channel.c +++ b/src/core/ext/client_config/client_channel.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); } } diff --git a/src/core/ext/client_config/resolver.c b/src/core/ext/client_config/resolver.c index 0e6b3780260..23a357ef36d 100644 --- a/src/core/ext/client_config/resolver.c +++ b/src/core/ext/client_config/resolver.c @@ -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); } diff --git a/src/core/ext/client_config/resolver.h b/src/core/ext/client_config/resolver.h index acd619bf9e9..c0d1ff3c69d 100644 --- a/src/core/ext/client_config/resolver.h +++ b/src/core/ext/client_config/resolver.h @@ -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); diff --git a/src/core/ext/resolver/dns/c_ares/dns_resolver_ares.c b/src/core/ext/resolver/dns/c_ares/dns_resolver_ares.c index 935d39ab65e..b93dcbdd18f 100644 --- a/src/core/ext/resolver/dns/c_ares/dns_resolver_ares.c +++ b/src/core/ext/resolver/dns/c_ares/dns_resolver_ares.c @@ -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); diff --git a/src/core/ext/resolver/dns/c_ares/grpc_ares_wrapper.c b/src/core/ext/resolver/dns/c_ares/grpc_ares_wrapper.c index 93358416ce7..52654e0c9d1 100644 --- a/src/core/ext/resolver/dns/c_ares/grpc_ares_wrapper.c +++ b/src/core/ext/resolver/dns/c_ares/grpc_ares_wrapper.c @@ -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 */ diff --git a/src/core/ext/resolver/dns/c_ares/grpc_ares_wrapper.h b/src/core/ext/resolver/dns/c_ares/grpc_ares_wrapper.h index d317dee0837..b7440b533d1 100644 --- a/src/core/ext/resolver/dns/c_ares/grpc_ares_wrapper.h +++ b/src/core/ext/resolver/dns/c_ares/grpc_ares_wrapper.h @@ -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 */ diff --git a/src/core/ext/resolver/dns/c_ares/grpc_ares_wrapper_fallback.c b/src/core/ext/resolver/dns/c_ares/grpc_ares_wrapper_fallback.c index 1b008c312bc..6c1053a5550 100644 --- a/src/core/ext/resolver/dns/c_ares/grpc_ares_wrapper_fallback.c +++ b/src/core/ext/resolver/dns/c_ares/grpc_ares_wrapper_fallback.c @@ -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 */ diff --git a/src/core/ext/resolver/dns/native/dns_resolver.c b/src/core/ext/resolver/dns/native/dns_resolver.c index 37d95dae59b..fa33ffd7bd5 100644 --- a/src/core/ext/resolver/dns/native/dns_resolver.c +++ b/src/core/ext/resolver/dns/native/dns_resolver.c @@ -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; diff --git a/src/core/ext/resolver/sockaddr/sockaddr_resolver.c b/src/core/ext/resolver/sockaddr/sockaddr_resolver.c index 8aa4e3fe633..5a7a32d7cb7 100644 --- a/src/core/ext/resolver/sockaddr/sockaddr_resolver.c +++ b/src/core/ext/resolver/sockaddr/sockaddr_resolver.c @@ -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; diff --git a/test/core/client_config/resolvers/dns_resolver_connectivity_test.c b/test/core/client_config/resolvers/dns_resolver_connectivity_test.c index 6be1e7e51b7..ed49269eb6a 100644 --- a/test/core/client_config/resolvers/dns_resolver_connectivity_test.c +++ b/test/core/client_config/resolvers/dns_resolver_connectivity_test.c @@ -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)); diff --git a/test/core/client_config/resolvers/sockaddr_resolver_test.c b/test/core/client_config/resolvers/sockaddr_resolver_test.c index 86885b6dcd9..b5d96efa1d9 100644 --- a/test/core/client_config/resolvers/sockaddr_resolver_test.c +++ b/test/core/client_config/resolvers/sockaddr_resolver_test.c @@ -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); diff --git a/test/core/end2end/fake_resolver.c b/test/core/end2end/fake_resolver.c index 593644521c7..8a6624a49ab 100644 --- a/test/core/end2end/fake_resolver.c +++ b/test/core/end2end/fake_resolver.c @@ -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;