pull/36723/head
Craig Tiller 9 months ago
parent 474afab8be
commit 21f5915111
  1. 15
      src/core/client_channel/client_channel.cc
  2. 6
      src/core/client_channel/load_balanced_call_destination.cc
  3. 4
      src/core/client_channel/subchannel.cc

@ -319,8 +319,7 @@ void ClientChannel::SubchannelWrapper::Orphaned() {
if (subchannel_node != nullptr) {
auto it = self->client_channel_->subchannel_refcount_map_.find(
self->subchannel_.get());
GPR_ASSERT(it !=
self->client_channel_->subchannel_refcount_map_.end());
CHECK(it != self->client_channel_->subchannel_refcount_map_.end());
--it->second;
if (it->second == 0) {
self->client_channel_->channelz_node_->RemoveChildSubchannel(
@ -336,7 +335,7 @@ void ClientChannel::SubchannelWrapper::Orphaned() {
void ClientChannel::SubchannelWrapper::WatchConnectivityState(
std::unique_ptr<ConnectivityStateWatcherInterface> watcher) {
auto& watcher_wrapper = watcher_map_[watcher.get()];
GPR_ASSERT(watcher_wrapper == nullptr);
CHECK(watcher_wrapper == nullptr);
watcher_wrapper = new WatcherWrapper(
std::move(watcher),
RefAsSubclass<SubchannelWrapper>(DEBUG_LOCATION, "WatcherWrapper"));
@ -348,7 +347,7 @@ void ClientChannel::SubchannelWrapper::WatchConnectivityState(
void ClientChannel::SubchannelWrapper::CancelConnectivityStateWatch(
ConnectivityStateWatcherInterface* watcher) {
auto it = watcher_map_.find(watcher);
GPR_ASSERT(it != watcher_map_.end());
CHECK(it != watcher_map_.end());
subchannel_->CancelConnectivityStateWatch(it->second);
watcher_map_.erase(it);
}
@ -357,7 +356,7 @@ void ClientChannel::SubchannelWrapper::AddDataWatcher(
std::unique_ptr<DataWatcherInterface> watcher) {
static_cast<InternalSubchannelDataWatcherInterface*>(watcher.get())
->SetSubchannel(subchannel_.get());
GPR_ASSERT(data_watchers_.insert(std::move(watcher)).second);
CHECK(data_watchers_.insert(std::move(watcher)).second);
}
void ClientChannel::SubchannelWrapper::CancelDataWatcher(
@ -823,7 +822,7 @@ void ClientChannel::CreateResolverLocked() {
std::make_unique<ResolverResultHandler>(RefAsSubclass<ClientChannel>()));
// Since the validity of the args was checked when the channel was created,
// CreateResolver() must return a non-null result.
GPR_ASSERT(resolver_ != nullptr);
CHECK(resolver_ != nullptr);
UpdateStateLocked(GRPC_CHANNEL_CONNECTING, absl::Status(),
"started resolving");
resolver_->StartLocked();
@ -920,7 +919,7 @@ RefCountedPtr<LoadBalancingPolicy::Config> ChooseLbPolicy(
// - A channel arg, in which case we check that the specified policy exists
// and accepts an empty config. If not, we revert to using pick_first
// lb_policy
GPR_ASSERT(lb_policy_config.ok());
CHECK_OK(lb_policy_config);
return std::move(*lb_policy_config);
}
@ -1196,7 +1195,7 @@ void ClientChannel::UpdateServiceConfigInDataPlaneLocked() {
channel_args_.SetObject(this).SetObject(service_config);
RefCountedPtr<DynamicFilters> dynamic_filters =
DynamicFilters::Create(new_args, std::move(filters));
GPR_ASSERT(dynamic_filters != nullptr);
CHECK(dynamic_filters != nullptr);
#endif
// Create call destination.
const bool enable_retries =

@ -152,7 +152,7 @@ T HandlePickResult(
}
auto* drop_pick =
absl::get_if<LoadBalancingPolicy::PickResult::Drop>(&result->result);
GPR_ASSERT(drop_pick != nullptr);
CHECK(drop_pick != nullptr);
return drop_func(drop_pick);
}
@ -171,7 +171,7 @@ LoopCtl<absl::StatusOr<RefCountedPtr<UnstartedCallDestination>>> PickSubchannel(
unstarted_handler.UnprocessedClientInitialMetadata();
LoadBalancingPolicy::PickArgs pick_args;
Slice* path = client_initial_metadata.get_pointer(HttpPathMetadata());
GPR_ASSERT(path != nullptr);
CHECK(path != nullptr);
pick_args.path = path->as_string_view();
LbCallState lb_call_state;
pick_args.call_state = &lb_call_state;
@ -191,7 +191,7 @@ LoopCtl<absl::StatusOr<RefCountedPtr<UnstartedCallDestination>>> PickSubchannel(
GetContext<Activity>()->DebugTag().c_str(),
complete_pick->subchannel.get());
}
GPR_ASSERT(complete_pick->subchannel != nullptr);
CHECK(complete_pick->subchannel != nullptr);
// Grab a ref to the connected subchannel while we're still
// holding the data plane mutex.
auto call_destination =

@ -170,7 +170,7 @@ class LegacyConnectedSubchannel : public ConnectedSubchannel {
[self = Ref()](ServerMetadataHandle metadata) {
channelz::SubchannelNode* channelz_subchannel =
self->channelz_subchannel();
GPR_ASSERT(channelz_subchannel != nullptr);
CHECK(channelz_subchannel != nullptr);
if (metadata->get(GrpcStatusMetadata())
.value_or(GRPC_STATUS_UNKNOWN) != GRPC_STATUS_OK) {
channelz_subchannel->RecordCallFailed();
@ -182,7 +182,7 @@ class LegacyConnectedSubchannel : public ConnectedSubchannel {
[self = Ref()]() {
channelz::SubchannelNode* channelz_subchannel =
self->channelz_subchannel();
GPR_ASSERT(channelz_subchannel != nullptr);
CHECK(channelz_subchannel != nullptr);
channelz_subchannel->RecordCallFailed();
});
}

Loading…
Cancel
Save