diff options
author | 2017-02-13 22:44:01 -0800 | |
---|---|---|
committer | 2017-03-17 15:53:50 -0700 | |
commit | dc6b569d97aa54e987681f869f13acdd9c89834f (patch) | |
tree | 1c24d64f042954f521c32742d5981e79c8fc807e /src/core/ext | |
parent | d10749251c21b4c52c4ec54c2d17b42db25b0c70 (diff) |
Print debug info
Diffstat (limited to 'src/core/ext')
-rw-r--r-- | src/core/ext/resolver/dns/c_ares/grpc_ares_wrapper.c | 32 |
1 files changed, 11 insertions, 21 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 8e54982571..77f87c8a57 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 @@ -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); gpr_log(GPR_DEBUG, "c-ares resolver gets a AF_INET6 result: \n" - " addr: %s\n port: %s\n", - output, r->port); + " addr: %s\n port: %s\n sin6_scope_id: %d\n", + output, r->port, addr->sin6_scope_id); } else { (*addresses)->addrs[i].len = sizeof(struct sockaddr_in); 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); } -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, const char *default_port, 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->success = false; r->error = GRPC_ERROR_NONE; - grpc_closure_sched(exec_ctx, grpc_closure_create(start_resolving, r, - grpc_schedule_on_exec_ctx), - GRPC_ERROR_NONE); + ares_channel *channel = grpc_ares_ev_driver_get_channel(r->ev_driver); + 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); return; error_cleanup: |