aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/ext/resolver
diff options
context:
space:
mode:
authorGravatar David Garcia Quintas <dgq@google.com>2016-09-12 18:37:05 -0700
committerGravatar David Garcia Quintas <dgq@google.com>2016-09-12 22:57:02 -0700
commit331b9c02f9372ef832e612d48b90991c181ba8a7 (patch)
tree02fa9ad3354a9f13a2f83e7da63b02e04e87c993 /src/core/ext/resolver
parent42adfb89ce3f842bf7a3d24e9f04b32d46644457 (diff)
Moved LB token changes solely into grpclb.c
Diffstat (limited to 'src/core/ext/resolver')
-rw-r--r--src/core/ext/resolver/dns/native/dns_resolver.c9
-rw-r--r--src/core/ext/resolver/sockaddr/sockaddr_resolver.c10
2 files changed, 17 insertions, 2 deletions
diff --git a/src/core/ext/resolver/dns/native/dns_resolver.c b/src/core/ext/resolver/dns/native/dns_resolver.c
index 79682e78b5..1841a75845 100644
--- a/src/core/ext/resolver/dns/native/dns_resolver.c
+++ b/src/core/ext/resolver/dns/native/dns_resolver.c
@@ -175,7 +175,14 @@ static void dns_on_resolved(grpc_exec_ctx *exec_ctx, void *arg,
grpc_lb_policy_args lb_policy_args;
result = grpc_resolver_result_create();
memset(&lb_policy_args, 0, sizeof(lb_policy_args));
- lb_policy_args.addresses = addresses;
+ lb_policy_args.num_addresses = addresses->naddrs;
+ lb_policy_args.lb_addresses =
+ gpr_malloc(sizeof(grpc_lb_address) * lb_policy_args.num_addresses);
+ memset(lb_policy_args.lb_addresses, 0,
+ sizeof(grpc_lb_address) * lb_policy_args.num_addresses);
+ for (size_t i = 0; i < addresses->naddrs; ++i) {
+ lb_policy_args.lb_addresses[i].resolved_address = &r->addresses->addrs[i];
+ }
lb_policy_args.client_channel_factory = r->client_channel_factory;
lb_policy =
grpc_lb_policy_create(exec_ctx, r->lb_policy_name, &lb_policy_args);
diff --git a/src/core/ext/resolver/sockaddr/sockaddr_resolver.c b/src/core/ext/resolver/sockaddr/sockaddr_resolver.c
index 3807522d2b..54a7e1c84c 100644
--- a/src/core/ext/resolver/sockaddr/sockaddr_resolver.c
+++ b/src/core/ext/resolver/sockaddr/sockaddr_resolver.c
@@ -125,10 +125,18 @@ static void sockaddr_maybe_finish_next_locked(grpc_exec_ctx *exec_ctx,
grpc_resolver_result *result = grpc_resolver_result_create();
grpc_lb_policy_args lb_policy_args;
memset(&lb_policy_args, 0, sizeof(lb_policy_args));
- lb_policy_args.addresses = r->addresses;
+ lb_policy_args.num_addresses = r->addresses->naddrs;
+ lb_policy_args.lb_addresses =
+ gpr_malloc(sizeof(grpc_lb_address) * lb_policy_args.num_addresses);
+ memset(lb_policy_args.lb_addresses, 0,
+ sizeof(grpc_lb_address) * lb_policy_args.num_addresses);
+ for (size_t i = 0; i < lb_policy_args.num_addresses; ++i) {
+ lb_policy_args.lb_addresses[i].resolved_address = &r->addresses->addrs[i];
+ }
lb_policy_args.client_channel_factory = r->client_channel_factory;
grpc_lb_policy *lb_policy =
grpc_lb_policy_create(exec_ctx, r->lb_policy_name, &lb_policy_args);
+ gpr_free(lb_policy_args.lb_addresses);
grpc_resolver_result_set_lb_policy(result, lb_policy);
GRPC_LB_POLICY_UNREF(exec_ctx, lb_policy, "sockaddr");
r->published = 1;