Fix error refcounting. Remove unnecessary check in PF.

reviewable/pr14886/r4
Mark D. Roth 7 years ago
parent 2b243bf3b0
commit 99dbd7a975
  1. 10
      src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc
  2. 2
      src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc
  3. 4
      src/core/ext/filters/client_channel/lb_policy/subchannel_list.h

@ -433,18 +433,12 @@ void PickFirst::PickFirstSubchannelData::ProcessConnectivityChangeLocked(
grpc_connectivity_state_name(connectivity_state()), p->shutdown_,
subchannel_list()->shutting_down(), grpc_error_string(error));
}
// If the policy is shutting down, unref and return.
if (p->shutdown_) {
StopConnectivityWatchLocked();
UnrefSubchannelLocked("pf_shutdown");
subchannel_list()->UnrefForConnectivityWatch("pf_shutdown");
return;
}
// If the subchannel list is shutting down, stop watching.
if (subchannel_list()->shutting_down() || error == GRPC_ERROR_CANCELLED) {
StopConnectivityWatchLocked();
UnrefSubchannelLocked("pf_sl_shutdown");
subchannel_list()->UnrefForConnectivityWatch("pf_sl_shutdown");
GRPC_ERROR_UNREF(error);
return;
}
// If we're still here, the notification must be for a subchannel in
@ -492,6 +486,7 @@ void PickFirst::PickFirstSubchannelData::ProcessConnectivityChangeLocked(
StartConnectivityWatchLocked();
}
}
GRPC_ERROR_UNREF(error);
return;
}
// If we get here, there are two possible cases:
@ -574,6 +569,7 @@ void PickFirst::PickFirstSubchannelData::ProcessConnectivityChangeLocked(
case GRPC_CHANNEL_SHUTDOWN:
GPR_UNREACHABLE_CODE(break);
}
GRPC_ERROR_UNREF(error);
}
//

@ -600,6 +600,7 @@ void RoundRobin::RoundRobinSubchannelData::ProcessConnectivityChangeLocked(
StopConnectivityWatchLocked();
UnrefSubchannelLocked("rr_sl_shutdown");
subchannel_list()->UnrefForConnectivityWatch("rr_sl_shutdown");
GRPC_ERROR_UNREF(error);
return;
}
// Process the state change.
@ -640,6 +641,7 @@ void RoundRobin::RoundRobinSubchannelData::ProcessConnectivityChangeLocked(
subchannel_list()->UpdateOverallStateLocked();
StartConnectivityWatchLocked();
}
GRPC_ERROR_UNREF(error);
}
grpc_connectivity_state RoundRobin::CheckConnectivityLocked(

@ -124,6 +124,8 @@ class SubchannelData {
if (pending_connectivity_state_unsafe_ != curr_connectivity_state_) {
curr_connectivity_state_ = pending_connectivity_state_unsafe_;
ProcessConnectivityChangeLocked(error);
} else {
GRPC_ERROR_UNREF(error);
}
}
@ -354,7 +356,7 @@ void SubchannelData<SubchannelListType, SubchannelDataType>::
if (sd->curr_connectivity_state_ == GRPC_CHANNEL_TRANSIENT_FAILURE) {
sd->connected_subchannel_.reset();
}
sd->ProcessConnectivityChangeLocked(error);
sd->ProcessConnectivityChangeLocked(GRPC_ERROR_REF(error));
}
template <typename SubchannelListType, typename SubchannelDataType>

Loading…
Cancel
Save