diff options
author | Vishal Powar <vishal.powar@gmail.com> | 2018-11-07 13:24:52 -0800 |
---|---|---|
committer | Vishal Powar <vishal.powar@gmail.com> | 2018-11-07 14:09:32 -0800 |
commit | 0f2414873379ad88344c0f606645ac985cf9066d (patch) | |
tree | 6c8e63f94daa366620ff4ef310cb27ac71687564 /src/core/ext/filters/client_channel | |
parent | 970552f1ac2c38ebd5beec86c6dc6be017e01c25 (diff) |
Simplify the code in CreateRoundRobinPolicyArgsLocked() to always expect
serverlist_ to be present.
Diffstat (limited to 'src/core/ext/filters/client_channel')
-rw-r--r-- | src/core/ext/filters/client_channel/lb_policy/xds/xds.cc | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc b/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc index 607e85a8ab..19ae18e7ea 100644 --- a/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc +++ b/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc @@ -1321,13 +1321,10 @@ void XdsLb::ProcessChannelArgsLocked(const grpc_channel_args& args) { void XdsLb::UpdateLocked(const grpc_channel_args& args) { ProcessChannelArgsLocked(args); - // If fallback is configured and the RR policy already exists, update - // it with the new fallback addresses. - // Note: We have disable fallback mode in the code, so this will only happen - // when rr_policy_ is set because we have balancer received serverlist. - if (lb_fallback_timeout_ms_ > 0 && rr_policy_ != nullptr) { - CreateOrUpdateRoundRobinPolicyLocked(); - } + // Note: We have disable fallback mode in the code, so we dont need to update + // the policy. + // TODO(vpowar): Handle the fallback_address changes when we add support for + // fallback in xDS. // Start watching the LB channel connectivity for connection, if not // already doing so. if (!watching_lb_channel_) { @@ -1642,15 +1639,12 @@ void XdsLb::CreateRoundRobinPolicyLocked(const Args& args) { grpc_channel_args* XdsLb::CreateRoundRobinPolicyArgsLocked() { grpc_lb_addresses* addresses; bool is_backend_from_grpclb_load_balancer = false; - if (serverlist_ != nullptr) { - GPR_ASSERT(serverlist_->num_servers > 0); - addresses = ProcessServerlist(serverlist_); - is_backend_from_grpclb_load_balancer = true; - } else { - // This should never be invoked if we do not have serverlist_, as fallback - // mode is disabled for xDS plugin. - return nullptr; - } + // This should never be invoked if we do not have serverlist_, as fallback + // mode is disabled for xDS plugin. + GPR_ASSERT(serverlist_ != nullptr); + GPR_ASSERT(serverlist_->num_servers > 0); + addresses = ProcessServerlist(serverlist_); + is_backend_from_grpclb_load_balancer = true; GPR_ASSERT(addresses != nullptr); // Replace the LB addresses in the channel args that we pass down to // the subchannel. |