diff options
author | Yuchen Zeng <zyc@google.com> | 2016-08-23 00:44:18 -0700 |
---|---|---|
committer | Yuchen Zeng <zyc@google.com> | 2016-08-23 00:44:18 -0700 |
commit | 6eb83cc23635997a9beda63e171bf1b6ce50c920 (patch) | |
tree | 70d017400c0ee3dd50963585dda17a70d0794de7 /src/core | |
parent | 502d644887f82837a762b300080e0b7f81117be3 (diff) |
Check if ipv6 is available
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/ext/resolver/dns/c_ares/grpc_ares_wrapper.c | 8 |
1 files changed, 6 insertions, 2 deletions
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 9251b3d708..2010cdef98 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 @@ -36,6 +36,7 @@ #include "src/core/ext/resolver/dns/c_ares/grpc_ares_wrapper.h" #include "src/core/lib/iomgr/sockaddr.h" +#include "src/core/lib/iomgr/socket_utils_posix.h" #include <string.h> #include <sys/types.h> @@ -184,9 +185,12 @@ static void request_resolving_address(grpc_exec_ctx *exec_ctx, void *arg, grpc_ares_ev_driver *ev_driver = r->ev_driver; ares_channel *channel = grpc_ares_ev_driver_get_channel(ev_driver); gpr_log(GPR_ERROR, "before ares_gethostbyname %s", r->host); - r->pending_quries = 2; + r->pending_quries = 1; + if (grpc_ipv6_loopback_available()) { + r->pending_quries += 1; + ares_gethostbyname(*channel, r->host, AF_INET6, on_done_cb, r); + } ares_gethostbyname(*channel, r->host, AF_INET, on_done_cb, r); - ares_gethostbyname(*channel, r->host, AF_INET6, on_done_cb, r); // grpc_ares_gethostbyname(r->ev_driver, r->host, on_dones_cb, r); gpr_log(GPR_ERROR, "before ares_getsock"); grpc_ares_notify_on_event(exec_ctx, ev_driver); |