Code review changes.

pull/12878/head
Mark D. Roth 7 years ago
parent 99f54e1572
commit aadf9f4b84
  1. 2
      src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc
  2. 5
      src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc
  3. 20
      src/core/ext/filters/client_channel/lb_policy/subchannel_list.h

@ -427,7 +427,7 @@ static void pf_connectivity_changed_locked(grpc_exec_ctx *exec_ctx, void *arg,
grpc_lb_subchannel_data_stop_connectivity_watch(exec_ctx, sd);
grpc_lb_subchannel_list_unref_for_connectivity_watch(
exec_ctx, sd->subchannel_list, "pf_selected_shutdown");
pf_shutdown_locked(exec_ctx, &p->base);
shutdown_locked(exec_ctx, p, GRPC_ERROR_REF(error));
}
}
return;

@ -187,15 +187,12 @@ static void rr_shutdown_locked(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol) {
grpc_connectivity_state_set(
exec_ctx, &p->state_tracker, GRPC_CHANNEL_SHUTDOWN,
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Channel Shutdown"), "rr_shutdown");
const bool latest_is_current =
p->subchannel_list == p->latest_pending_subchannel_list;
if (p->subchannel_list != NULL) {
grpc_lb_subchannel_list_shutdown_and_unref(exec_ctx, p->subchannel_list,
"sl_shutdown_rr_shutdown");
p->subchannel_list = NULL;
}
if (!latest_is_current && p->latest_pending_subchannel_list != NULL &&
!p->latest_pending_subchannel_list->shutting_down) {
if (p->latest_pending_subchannel_list != NULL) {
grpc_lb_subchannel_list_shutdown_and_unref(
exec_ctx, p->latest_pending_subchannel_list,
"sl_shutdown_pending_rr_shutdown");

@ -68,19 +68,19 @@ typedef struct {
const grpc_lb_user_data_vtable *user_data_vtable;
} grpc_lb_subchannel_data;
// Unrefs the subchannel contained in sd.
/// Unrefs the subchannel contained in sd.
void grpc_lb_subchannel_data_unref_subchannel(grpc_exec_ctx *exec_ctx,
grpc_lb_subchannel_data *sd,
const char *reason);
// Starts watching the connectivity state of the subchannel.
// The connectivity_changed_cb callback must invoke either
// grpc_lb_subchannel_data_stop_connectivity_watch() or again call
// grpc_lb_subchannel_data_start_connectivity_watch().
/// Starts watching the connectivity state of the subchannel.
/// The connectivity_changed_cb callback must invoke either
/// grpc_lb_subchannel_data_stop_connectivity_watch() or again call
/// grpc_lb_subchannel_data_start_connectivity_watch().
void grpc_lb_subchannel_data_start_connectivity_watch(
grpc_exec_ctx *exec_ctx, grpc_lb_subchannel_data *sd);
// Stops watching the connectivity state of the subchannel.
/// Stops watching the connectivity state of the subchannel.
void grpc_lb_subchannel_data_stop_connectivity_watch(
grpc_exec_ctx *exec_ctx, grpc_lb_subchannel_data *sd);
@ -132,16 +132,16 @@ void grpc_lb_subchannel_list_unref(grpc_exec_ctx *exec_ctx,
grpc_lb_subchannel_list *subchannel_list,
const char *reason);
// Takes and releases refs needed for a connectivity notification.
// This includes a ref to subchannel_list and a weak ref to the LB policy.
/// Takes and releases refs needed for a connectivity notification.
/// This includes a ref to subchannel_list and a weak ref to the LB policy.
void grpc_lb_subchannel_list_ref_for_connectivity_watch(
grpc_lb_subchannel_list *subchannel_list, const char *reason);
void grpc_lb_subchannel_list_unref_for_connectivity_watch(
grpc_exec_ctx *exec_ctx, grpc_lb_subchannel_list *subchannel_list,
const char *reason);
// Mark subchannel_list as discarded. Unsubscribes all its subchannels. The
// connectivity state notification callback will ultimately unref it.
/// Mark subchannel_list as discarded. Unsubscribes all its subchannels. The
/// connectivity state notification callback will ultimately unref it.
void grpc_lb_subchannel_list_shutdown_and_unref(
grpc_exec_ctx *exec_ctx, grpc_lb_subchannel_list *subchannel_list,
const char *reason);

Loading…
Cancel
Save