|
|
|
@ -54,6 +54,7 @@ typedef struct { |
|
|
|
|
char *default_port; |
|
|
|
|
grpc_resolve_cb cb; |
|
|
|
|
void *arg; |
|
|
|
|
grpc_iomgr_object iomgr_object; |
|
|
|
|
} request; |
|
|
|
|
|
|
|
|
|
grpc_resolved_addresses *grpc_blocking_resolve_address( |
|
|
|
@ -135,7 +136,7 @@ static void do_request(void *rp) { |
|
|
|
|
gpr_free(r->default_port); |
|
|
|
|
gpr_free(r); |
|
|
|
|
cb(arg, resolved); |
|
|
|
|
grpc_iomgr_unref(); |
|
|
|
|
grpc_iomgr_unregister_object(&r->iomgr_object); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void grpc_resolved_addresses_destroy(grpc_resolved_addresses *addrs) { |
|
|
|
@ -147,7 +148,10 @@ void grpc_resolve_address(const char *name, const char *default_port, |
|
|
|
|
grpc_resolve_cb cb, void *arg) { |
|
|
|
|
request *r = gpr_malloc(sizeof(request)); |
|
|
|
|
gpr_thd_id id; |
|
|
|
|
grpc_iomgr_ref(); |
|
|
|
|
const char *label; |
|
|
|
|
gpr_asprintf(&label, "resolve:%s", name); |
|
|
|
|
grpc_iomgr_register_object(&r->iomgr_object, label); |
|
|
|
|
gpr_free(label); |
|
|
|
|
r->name = gpr_strdup(name); |
|
|
|
|
r->default_port = gpr_strdup(default_port); |
|
|
|
|
r->cb = cb; |
|
|
|
|