|
|
@ -156,8 +156,8 @@ static void on_done_cb(void *arg, int status, int timeouts, |
|
|
|
ares_inet_ntop(AF_INET6, &addr->sin6_addr, output, INET6_ADDRSTRLEN); |
|
|
|
ares_inet_ntop(AF_INET6, &addr->sin6_addr, output, INET6_ADDRSTRLEN); |
|
|
|
gpr_log(GPR_DEBUG, |
|
|
|
gpr_log(GPR_DEBUG, |
|
|
|
"c-ares resolver gets a AF_INET6 result: \n" |
|
|
|
"c-ares resolver gets a AF_INET6 result: \n" |
|
|
|
" addr: %s\n port: %s\n", |
|
|
|
" addr: %s\n port: %s\n sin6_scope_id: %d\n", |
|
|
|
output, r->port); |
|
|
|
output, r->port, addr->sin6_scope_id); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
(*addresses)->addrs[i].len = sizeof(struct sockaddr_in); |
|
|
|
(*addresses)->addrs[i].len = sizeof(struct sockaddr_in); |
|
|
|
struct sockaddr_in *addr = |
|
|
|
struct sockaddr_in *addr = |
|
|
@ -191,22 +191,6 @@ static void on_done_cb(void *arg, int status, int timeouts, |
|
|
|
grpc_ares_request_unref(NULL, r); |
|
|
|
grpc_ares_request_unref(NULL, r); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void start_resolving(grpc_exec_ctx *exec_ctx, void *arg, |
|
|
|
|
|
|
|
grpc_error *error) { |
|
|
|
|
|
|
|
grpc_ares_request *r = (grpc_ares_request *)arg; |
|
|
|
|
|
|
|
ares_channel *channel = grpc_ares_ev_driver_get_channel(r->ev_driver); |
|
|
|
|
|
|
|
// An extra reference is put here to avoid destroying the request in
|
|
|
|
|
|
|
|
// on_done_cb before calling grpc_ares_ev_driver_start.
|
|
|
|
|
|
|
|
gpr_ref_init(&r->pending_queries, 2); |
|
|
|
|
|
|
|
if (grpc_ipv6_loopback_available()) { |
|
|
|
|
|
|
|
gpr_ref(&r->pending_queries); |
|
|
|
|
|
|
|
ares_gethostbyname(*channel, r->host, AF_INET6, on_done_cb, r); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
ares_gethostbyname(*channel, r->host, AF_INET, on_done_cb, r); |
|
|
|
|
|
|
|
grpc_ares_ev_driver_start(exec_ctx, r->ev_driver); |
|
|
|
|
|
|
|
grpc_ares_request_unref(exec_ctx, r); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void grpc_resolve_address_ares_impl(grpc_exec_ctx *exec_ctx, const char *name, |
|
|
|
void grpc_resolve_address_ares_impl(grpc_exec_ctx *exec_ctx, const char *name, |
|
|
|
const char *default_port, |
|
|
|
const char *default_port, |
|
|
|
grpc_pollset_set *interested_parties, |
|
|
|
grpc_pollset_set *interested_parties, |
|
|
@ -249,9 +233,15 @@ void grpc_resolve_address_ares_impl(grpc_exec_ctx *exec_ctx, const char *name, |
|
|
|
r->host = host; |
|
|
|
r->host = host; |
|
|
|
r->success = false; |
|
|
|
r->success = false; |
|
|
|
r->error = GRPC_ERROR_NONE; |
|
|
|
r->error = GRPC_ERROR_NONE; |
|
|
|
grpc_closure_sched(exec_ctx, grpc_closure_create(start_resolving, r, |
|
|
|
ares_channel *channel = grpc_ares_ev_driver_get_channel(r->ev_driver); |
|
|
|
grpc_schedule_on_exec_ctx), |
|
|
|
gpr_ref_init(&r->pending_queries, 2); |
|
|
|
GRPC_ERROR_NONE); |
|
|
|
if (grpc_ipv6_loopback_available()) { |
|
|
|
|
|
|
|
gpr_ref(&r->pending_queries); |
|
|
|
|
|
|
|
ares_gethostbyname(*channel, r->host, AF_INET6, on_done_cb, r); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
ares_gethostbyname(*channel, r->host, AF_INET, on_done_cb, r); |
|
|
|
|
|
|
|
grpc_ares_ev_driver_start(exec_ctx, r->ev_driver); |
|
|
|
|
|
|
|
grpc_ares_request_unref(exec_ctx, r); |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
error_cleanup: |
|
|
|
error_cleanup: |
|
|
|