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 | |
parent | 9b52965ba4157d098bb951c892e18a1361917200 (diff) |
Put c-ares queries under a combiner
Diffstat (limited to 'test')
4 files changed, 30 insertions, 30 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); diff --git a/test/core/end2end/fuzzers/api_fuzzer.cc b/test/core/end2end/fuzzers/api_fuzzer.cc index 36f257d6da..ccb194cdf5 100644 --- a/test/core/end2end/fuzzers/api_fuzzer.cc +++ b/test/core/end2end/fuzzers/api_fuzzer.cc @@ -374,13 +374,11 @@ void my_resolve_address(const char* addr, const char* default_port, static grpc_address_resolver_vtable fuzzer_resolver = {my_resolve_address, nullptr}; -grpc_ares_request* my_dns_lookup_ares(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_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_combiner* combiner) { addr_req* r = static_cast<addr_req*>(gpr_malloc(sizeof(*r))); r->addr = gpr_strdup(addr); r->on_done = on_done; @@ -706,7 +704,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { grpc_executor_set_threading(false); } grpc_set_resolver_impl(&fuzzer_resolver); - grpc_dns_lookup_ares = my_dns_lookup_ares; + grpc_dns_lookup_ares_locked = my_dns_lookup_ares_locked; GPR_ASSERT(g_channel == nullptr); GPR_ASSERT(g_server == nullptr); diff --git a/test/core/end2end/goaway_server_test.cc b/test/core/end2end/goaway_server_test.cc index 0188698f17..8904c3d325 100644 --- a/test/core/end2end/goaway_server_test.cc +++ b/test/core/end2end/goaway_server_test.cc @@ -44,11 +44,11 @@ static void* tag(intptr_t i) { return (void*)i; } static gpr_mu g_mu; static int g_resolve_port = -1; -static grpc_ares_request* (*iomgr_dns_lookup_ares)( +static grpc_ares_request* (*iomgr_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** addresses, bool check_grpclb, - char** service_config_json); + char** service_config_json, grpc_combiner* combiner); static void set_resolve_port(int port) { gpr_mu_lock(&g_mu); @@ -98,15 +98,15 @@ static grpc_error* my_blocking_resolve_address( static grpc_address_resolver_vtable test_resolver = { my_resolve_address, my_blocking_resolve_address}; -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) { if (0 != strcmp(addr, "test")) { - return iomgr_dns_lookup_ares(dns_server, addr, default_port, - interested_parties, on_done, lb_addrs, - check_grpclb, service_config_json); + return iomgr_dns_lookup_ares_locked( + dns_server, addr, default_port, interested_parties, on_done, lb_addrs, + check_grpclb, service_config_json, combiner); } grpc_error* error = GRPC_ERROR_NONE; @@ -142,8 +142,8 @@ int main(int argc, char** argv) { grpc_init(); default_resolver = grpc_resolve_address_impl; grpc_set_resolver_impl(&test_resolver); - iomgr_dns_lookup_ares = grpc_dns_lookup_ares; - grpc_dns_lookup_ares = my_dns_lookup_ares; + iomgr_dns_lookup_ares_locked = grpc_dns_lookup_ares_locked; + grpc_dns_lookup_ares_locked = my_dns_lookup_ares_locked; int was_cancelled1; int was_cancelled2; |