aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Mark D. Roth <roth@google.com>2017-11-15 12:56:31 -0800
committerGravatar GitHub <noreply@github.com>2017-11-15 12:56:31 -0800
commitff2edb3eba20b30f232ded7769cab8cd20ff5009 (patch)
tree14717319baf67625d601545a8a45d97e74441317
parent366e23b604d6458787ef8df77a2fed9c6d861f45 (diff)
parentfdb1a2b904d25f2c02040f0ea21cbfddbb459e55 (diff)
Merge pull request #13402 from markdroth/pf_subchannel_ref_fix
Take a ref to the connected subchannel before unreffing it.
-rw-r--r--src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc16
1 files changed, 8 insertions, 8 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 caa6aee9a6..dbd4754e87 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
@@ -305,20 +305,20 @@ static void pf_update_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy,
p, p->selected->subchannel, i,
subchannel_list->num_subchannels);
}
- grpc_lb_subchannel_list_ref_for_connectivity_watch(
- subchannel_list, "connectivity_watch+replace_selected");
- grpc_lb_subchannel_data_start_connectivity_watch(exec_ctx, sd);
- if (p->subchannel_list != nullptr) {
- grpc_lb_subchannel_list_shutdown_and_unref(
- exec_ctx, p->subchannel_list, "pf_update_includes_selected");
- }
- p->subchannel_list = subchannel_list;
if (p->selected->connected_subchannel != nullptr) {
sd->connected_subchannel = GRPC_CONNECTED_SUBCHANNEL_REF(
p->selected->connected_subchannel, "pf_update_includes_selected");
}
p->selected = sd;
+ if (p->subchannel_list != nullptr) {
+ grpc_lb_subchannel_list_shutdown_and_unref(
+ exec_ctx, p->subchannel_list, "pf_update_includes_selected");
+ }
+ p->subchannel_list = subchannel_list;
destroy_unselected_subchannels_locked(exec_ctx, p);
+ grpc_lb_subchannel_list_ref_for_connectivity_watch(
+ subchannel_list, "connectivity_watch+replace_selected");
+ grpc_lb_subchannel_data_start_connectivity_watch(exec_ctx, sd);
// If there was a previously pending update (which may or may
// not have contained the currently selected subchannel), drop
// it, so that it doesn't override what we've done here.