diff options
author | Alexander Polcyn <apolcyn@google.com> | 2018-05-20 02:36:27 -0700 |
---|---|---|
committer | Alexander Polcyn <apolcyn@google.com> | 2018-06-13 10:40:53 -0700 |
commit | 626cea8f734313e7ac7188e877d9a8fbfccc67c7 (patch) | |
tree | 5b1b52d0b148c017ac1a862e80255da697afa430 /test/core/client_channel | |
parent | 9b52965ba4157d098bb951c892e18a1361917200 (diff) |
Put c-ares queries under a combiner
Diffstat (limited to 'test/core/client_channel')
-rw-r--r-- | test/core/client_channel/resolvers/dns_resolver_connectivity_test.cc | 8 | ||||
-rw-r--r-- | test/core/client_channel/resolvers/dns_resolver_cooldown_test.cc | 18 |
2 files changed, 14 insertions, 12 deletions
diff --git a/test/core/client_channel/resolvers/dns_resolver_connectivity_test.cc b/test/core/client_channel/resolvers/dns_resolver_connectivity_test.cc index e34aa2e676..1c8d0775ab 100644 --- a/test/core/client_channel/resolvers/dns_resolver_connectivity_test.cc +++ b/test/core/client_channel/resolvers/dns_resolver_connectivity_test.cc @@ -60,11 +60,11 @@ static void my_resolve_address(const char* addr, const char* default_port, static grpc_address_resolver_vtable test_resolver = {my_resolve_address, nullptr}; -static grpc_ares_request* my_dns_lookup_ares( +static grpc_ares_request* my_dns_lookup_ares_locked( const char* dns_server, const char* addr, const char* default_port, grpc_pollset_set* interested_parties, grpc_closure* on_done, - grpc_lb_addresses** lb_addrs, bool check_grpclb, - char** service_config_json) { + grpc_lb_addresses** lb_addrs, bool check_grpclb, char** service_config_json, + grpc_combiner* combiner) { gpr_mu_lock(&g_mu); GPR_ASSERT(0 == strcmp("test", addr)); grpc_error* error = GRPC_ERROR_NONE; @@ -147,7 +147,7 @@ int main(int argc, char** argv) { gpr_mu_init(&g_mu); g_combiner = grpc_combiner_create(); grpc_set_resolver_impl(&test_resolver); - grpc_dns_lookup_ares = my_dns_lookup_ares; + grpc_dns_lookup_ares_locked = my_dns_lookup_ares_locked; grpc_channel_args* result = (grpc_channel_args*)1; { diff --git a/test/core/client_channel/resolvers/dns_resolver_cooldown_test.cc b/test/core/client_channel/resolvers/dns_resolver_cooldown_test.cc index 521fc3107e..b1f3a1c08a 100644 --- a/test/core/client_channel/resolvers/dns_resolver_cooldown_test.cc +++ b/test/core/client_channel/resolvers/dns_resolver_cooldown_test.cc @@ -33,10 +33,11 @@ static grpc_address_resolver_vtable* default_resolve_address; static grpc_combiner* g_combiner; -grpc_ares_request* (*g_default_dns_lookup_ares)( +grpc_ares_request* (*g_default_dns_lookup_ares_locked)( const char* dns_server, const char* name, const char* default_port, grpc_pollset_set* interested_parties, grpc_closure* on_done, - grpc_lb_addresses** addrs, bool check_grpclb, char** service_config_json); + grpc_lb_addresses** addrs, bool check_grpclb, char** service_config_json, + grpc_combiner* combiner); // Counter incremented by test_resolve_address_impl indicating the number of // times a system-level resolution has happened. @@ -72,13 +73,14 @@ static grpc_error* test_blocking_resolve_address_impl( static grpc_address_resolver_vtable test_resolver = { test_resolve_address_impl, test_blocking_resolve_address_impl}; -grpc_ares_request* test_dns_lookup_ares( +grpc_ares_request* test_dns_lookup_ares_locked( const char* dns_server, const char* name, const char* default_port, grpc_pollset_set* interested_parties, grpc_closure* on_done, - grpc_lb_addresses** addrs, bool check_grpclb, char** service_config_json) { - grpc_ares_request* result = g_default_dns_lookup_ares( + grpc_lb_addresses** addrs, bool check_grpclb, char** service_config_json, + grpc_combiner* combiner) { + grpc_ares_request* result = g_default_dns_lookup_ares_locked( dns_server, name, default_port, g_iomgr_args.pollset_set, on_done, addrs, - check_grpclb, service_config_json); + check_grpclb, service_config_json, combiner); ++g_resolution_count; return result; } @@ -308,8 +310,8 @@ int main(int argc, char** argv) { g_combiner = grpc_combiner_create(); - g_default_dns_lookup_ares = grpc_dns_lookup_ares; - grpc_dns_lookup_ares = test_dns_lookup_ares; + g_default_dns_lookup_ares_locked = grpc_dns_lookup_ares_locked; + grpc_dns_lookup_ares_locked = test_dns_lookup_ares_locked; default_resolve_address = grpc_resolve_address_impl; grpc_set_resolver_impl(&test_resolver); |