From 6c5569167daf51503145ce791d0c5f6b99b016fd Mon Sep 17 00:00:00 2001 From: "Mark D. Roth" Date: Wed, 25 Oct 2017 07:59:51 -0700 Subject: [PATCH] Take ref to connected subchannel if subchannel starts in state READY. --- .../client_channel/lb_policy/pick_first/pick_first.cc | 5 ----- .../ext/filters/client_channel/lb_policy/subchannel_list.cc | 5 +++++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc b/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc index b19616a48e3..81f9bc5a989 100644 --- a/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +++ b/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc @@ -312,11 +312,6 @@ static void pf_update_locked(grpc_exec_ctx *exec_ctx, grpc_lb_policy *policy, exec_ctx, p->subchannel_list, "pf_update_includes_selected"); } p->subchannel_list = subchannel_list; - if (p->selected->connected_subchannel != NULL) { - sd->connected_subchannel = GRPC_CONNECTED_SUBCHANNEL_REF( - grpc_subchannel_get_connected_subchannel(sd->subchannel), - "pf_update_includes_selected"); - } p->selected = sd; destroy_unselected_subchannels_locked(exec_ctx, p); // If there was a previously pending update (which may or may diff --git a/src/core/ext/filters/client_channel/lb_policy/subchannel_list.cc b/src/core/ext/filters/client_channel/lb_policy/subchannel_list.cc index af7a6acdff4..cf3e9525ef3 100644 --- a/src/core/ext/filters/client_channel/lb_policy/subchannel_list.cc +++ b/src/core/ext/filters/client_channel/lb_policy/subchannel_list.cc @@ -179,6 +179,11 @@ grpc_lb_subchannel_list *grpc_lb_subchannel_list_create( sd->prev_connectivity_state = GRPC_CHANNEL_INIT; sd->curr_connectivity_state = subchannel_connectivity_state; sd->pending_connectivity_state_unsafe = subchannel_connectivity_state; + if (sd->curr_connectivity_state == GRPC_CHANNEL_READY) { + sd->connected_subchannel = GRPC_CONNECTED_SUBCHANNEL_REF( + grpc_subchannel_get_connected_subchannel(sd->subchannel), + "ready_at_sl_creation"); + } sd->user_data_vtable = addresses->user_data_vtable; if (sd->user_data_vtable != NULL) { sd->user_data =