Code review changes.

pull/12878/head
Mark D. Roth 7 years ago
parent 5132d0e609
commit 99f54e1572
  1. 5
      src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc
  2. 6
      src/core/ext/filters/client_channel/lb_policy/subchannel_list.cc

@ -409,11 +409,8 @@ static void pf_connectivity_changed_locked(grpc_exec_ctx *exec_ctx, void *arg,
exec_ctx, p->subchannel_list, "selected_not_ready+switch_to_update"); exec_ctx, p->subchannel_list, "selected_not_ready+switch_to_update");
p->subchannel_list = p->latest_pending_subchannel_list; p->subchannel_list = p->latest_pending_subchannel_list;
p->latest_pending_subchannel_list = NULL; p->latest_pending_subchannel_list = NULL;
grpc_lb_subchannel_data *new_sd =
&p->subchannel_list
->subchannels[p->subchannel_list->checking_subchannel];
grpc_connectivity_state_set( grpc_connectivity_state_set(
exec_ctx, &p->state_tracker, new_sd->curr_connectivity_state, exec_ctx, &p->state_tracker, GRPC_CHANNEL_TRANSIENT_FAILURE,
GRPC_ERROR_REF(error), "selected_not_ready+switch_to_update"); GRPC_ERROR_REF(error), "selected_not_ready+switch_to_update");
} else { } else {
if (sd->curr_connectivity_state == GRPC_CHANNEL_TRANSIENT_FAILURE) { if (sd->curr_connectivity_state == GRPC_CHANNEL_TRANSIENT_FAILURE) {

@ -107,7 +107,7 @@ grpc_lb_subchannel_list *grpc_lb_subchannel_list_create(
// subchannel keys of subchannels from a different batch of addresses. // subchannel keys of subchannels from a different batch of addresses.
static const char *keys_to_remove[] = {GRPC_ARG_SUBCHANNEL_ADDRESS, static const char *keys_to_remove[] = {GRPC_ARG_SUBCHANNEL_ADDRESS,
GRPC_ARG_LB_ADDRESSES}; GRPC_ARG_LB_ADDRESSES};
// Create a subchannels for each address. // Create a subchannel for each address.
grpc_subchannel_args sc_args; grpc_subchannel_args sc_args;
size_t subchannel_index = 0; size_t subchannel_index = 0;
for (size_t i = 0; i < addresses->num_addresses; i++) { for (size_t i = 0; i < addresses->num_addresses; i++) {
@ -245,7 +245,7 @@ void grpc_lb_subchannel_list_unref_for_connectivity_watch(
grpc_lb_subchannel_list_unref(exec_ctx, subchannel_list, reason); grpc_lb_subchannel_list_unref(exec_ctx, subchannel_list, reason);
} }
static void grpc_lb_subchannel_data_cancel_connectivity_watch( static void subchannel_data_cancel_connectivity_watch(
grpc_exec_ctx *exec_ctx, grpc_lb_subchannel_data *sd, const char *reason) { grpc_exec_ctx *exec_ctx, grpc_lb_subchannel_data *sd, const char *reason) {
if (GRPC_TRACER_ON(*sd->subchannel_list->tracer)) { if (GRPC_TRACER_ON(*sd->subchannel_list->tracer)) {
gpr_log( gpr_log(
@ -275,7 +275,7 @@ void grpc_lb_subchannel_list_shutdown_and_unref(
// the callback is responsible for unreffing the subchannel. // the callback is responsible for unreffing the subchannel.
// Otherwise, unref the subchannel directly. // Otherwise, unref the subchannel directly.
if (sd->connectivity_notification_pending) { if (sd->connectivity_notification_pending) {
grpc_lb_subchannel_data_cancel_connectivity_watch(exec_ctx, sd, reason); subchannel_data_cancel_connectivity_watch(exec_ctx, sd, reason);
} else if (sd->subchannel != NULL) { } else if (sd->subchannel != NULL) {
grpc_lb_subchannel_data_unref_subchannel(exec_ctx, sd, reason); grpc_lb_subchannel_data_unref_subchannel(exec_ctx, sd, reason);
} }

Loading…
Cancel
Save