Code review changes.

pull/8049/head
Mark D. Roth 8 years ago
parent 6053497f21
commit 7f7d165fa8
  1. 1
      src/core/ext/client_config/client_channel.c
  2. 16
      src/core/ext/client_config/lb_policy_factory.c
  3. 1
      src/core/ext/client_config/lb_policy_factory.h

@ -784,6 +784,7 @@ void grpc_client_channel_finish_initialization(
grpc_resolver *resolver,
grpc_client_channel_factory *client_channel_factory) {
/* post construction initialization: set the transport setup pointer */
GPR_ASSERT(client_channel_factory != NULL);
grpc_channel_element *elem = grpc_channel_stack_last_element(channel_stack);
channel_data *chand = elem->channel_data;
gpr_mu_lock(&chand->mu);

@ -49,19 +49,21 @@ grpc_lb_addresses* grpc_lb_addresses_create(size_t num_addresses) {
grpc_lb_addresses* grpc_lb_addresses_copy(grpc_lb_addresses* addresses,
void* (*user_data_copy)(void*)) {
grpc_lb_addresses* new = grpc_lb_addresses_create(addresses->num_addresses);
memcpy(new->addresses, addresses->addresses,
grpc_lb_addresses* new_addresses =
grpc_lb_addresses_create(addresses->num_addresses);
memcpy(new_addresses->addresses, addresses->addresses,
sizeof(grpc_lb_address) * addresses->num_addresses);
for (size_t i = 0; i < addresses->num_addresses; ++i) {
if (new->addresses[i].balancer_name != NULL) {
new->addresses[i].balancer_name =
gpr_strdup(new->addresses[i].balancer_name);
if (new_addresses->addresses[i].balancer_name != NULL) {
new_addresses->addresses[i].balancer_name =
gpr_strdup(new_addresses->addresses[i].balancer_name);
}
if (user_data_copy != NULL) {
new->addresses[i].user_data = user_data_copy(new->addresses[i].user_data);
new_addresses->addresses[i].user_data =
user_data_copy(new_addresses->addresses[i].user_data);
}
}
return new;
return new_addresses;
}
void grpc_lb_addresses_set_address(grpc_lb_addresses* addresses, size_t index,

@ -92,6 +92,7 @@ void grpc_lb_addresses_destroy(grpc_lb_addresses *addresses,
typedef struct grpc_lb_policy_args {
grpc_lb_addresses *addresses;
grpc_client_channel_factory *client_channel_factory;
/* Can be used to pass implementation-specific parameters to the LB policy. */
grpc_channel_args *additional_args;
} grpc_lb_policy_args;

Loading…
Cancel
Save