diff options
author | Mark D. Roth <roth@google.com> | 2016-09-07 08:28:00 -0700 |
---|---|---|
committer | Mark D. Roth <roth@google.com> | 2016-09-07 08:28:00 -0700 |
commit | e011b1e4cae5cedebea25f75fda69ba56b124572 (patch) | |
tree | 1af2c5b58cdc2cc97f519ac91b153ccc34b60985 /src/core/ext/lb_policy/round_robin | |
parent | f16823431072bfadcc534c134520e29fc244a25c (diff) |
Move is_balancer into a new struct in the client_config directory.
Diffstat (limited to 'src/core/ext/lb_policy/round_robin')
-rw-r--r-- | src/core/ext/lb_policy/round_robin/round_robin.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/core/ext/lb_policy/round_robin/round_robin.c b/src/core/ext/lb_policy/round_robin/round_robin.c index 2dc0a52744..fc1534887a 100644 --- a/src/core/ext/lb_policy/round_robin/round_robin.c +++ b/src/core/ext/lb_policy/round_robin/round_robin.c @@ -571,11 +571,11 @@ static grpc_lb_policy *round_robin_create(grpc_exec_ctx *exec_ctx, GPR_ASSERT(args->addresses != NULL); GPR_ASSERT(args->client_channel_factory != NULL); - // Find the number of backend addresses. We ignore balancer - // addresses, since we don't know how to handle them. + /* Find the number of backend addresses. We ignore balancer + * addresses, since we don't know how to handle them. */ size_t num_addrs = 0; - for (size_t i = 0; i < args->addresses->naddrs; i++) { - if (!args->addresses->addrs[i].is_balancer) ++num_addrs; + for (size_t i = 0; i < args->addresses->num_addresses; i++) { + if (!args->addresses->addresses[i].is_balancer) ++num_addrs; } if (num_addrs == 0) return NULL; @@ -587,13 +587,14 @@ static grpc_lb_policy *round_robin_create(grpc_exec_ctx *exec_ctx, grpc_subchannel_args sc_args; size_t subchannel_idx = 0; - for (size_t i = 0; i < args->addresses->naddrs; i++) { - // Skip balancer addresses, since we only know how to handle backends. - if (args->addresses->addrs[i].is_balancer) continue; + for (size_t i = 0; i < args->addresses->num_addresses; i++) { + /* Skip balancer addresses, since we only know how to handle backends. */ + if (args->addresses->addresses[i].is_balancer) continue; memset(&sc_args, 0, sizeof(grpc_subchannel_args)); - sc_args.addr = (struct sockaddr *)(args->addresses->addrs[i].addr); - sc_args.addr_len = (size_t)args->addresses->addrs[i].len; + sc_args.addr = + (struct sockaddr *)(&args->addresses->addresses[i].address.addr); + sc_args.addr_len = args->addresses->addresses[i].address.len; grpc_subchannel *subchannel = grpc_client_channel_factory_create_subchannel( exec_ctx, args->client_channel_factory, &sc_args); |