|
|
|
@ -878,24 +878,19 @@ class ChannelData::SubchannelWrapper : public SubchannelInterface { |
|
|
|
|
"chand=%p: destroying subchannel wrapper %p for subchannel %p", |
|
|
|
|
chand_, this, subchannel_); |
|
|
|
|
} |
|
|
|
|
auto *subchannel_wrapper = this; |
|
|
|
|
auto *subchannel = subchannel_; |
|
|
|
|
auto *chand = chand_; |
|
|
|
|
chand_->work_serializer()->Run([chand, subchannel, subchannel_wrapper]() { |
|
|
|
|
chand->subchannel_wrappers_.erase(subchannel_wrapper); |
|
|
|
|
auto* subchannel_node = subchannel->channelz_node(); |
|
|
|
|
chand_->subchannel_wrappers_.erase(this); |
|
|
|
|
auto* subchannel_node = subchannel_->channelz_node(); |
|
|
|
|
if (subchannel_node != nullptr) { |
|
|
|
|
auto it = chand->subchannel_refcount_map_.find(subchannel); |
|
|
|
|
GPR_ASSERT(it != chand->subchannel_refcount_map_.end()); |
|
|
|
|
auto it = chand_->subchannel_refcount_map_.find(subchannel_); |
|
|
|
|
GPR_ASSERT(it != chand_->subchannel_refcount_map_.end()); |
|
|
|
|
--it->second; |
|
|
|
|
if (it->second == 0) { |
|
|
|
|
chand->channelz_node_->RemoveChildSubchannel(subchannel_node->uuid()); |
|
|
|
|
chand->subchannel_refcount_map_.erase(it); |
|
|
|
|
chand_->channelz_node_->RemoveChildSubchannel(subchannel_node->uuid()); |
|
|
|
|
chand_->subchannel_refcount_map_.erase(it); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
GRPC_SUBCHANNEL_UNREF(subchannel, "unref from LB"); |
|
|
|
|
GRPC_CHANNEL_STACK_UNREF(chand->owning_stack_, "SubchannelWrapper"); |
|
|
|
|
}, DEBUG_LOCATION); |
|
|
|
|
GRPC_SUBCHANNEL_UNREF(subchannel_, "unref from LB"); |
|
|
|
|
GRPC_CHANNEL_STACK_UNREF(chand_->owning_stack_, "SubchannelWrapper"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
grpc_connectivity_state CheckConnectivityState() override { |
|
|
|
@ -1016,7 +1011,12 @@ class ChannelData::SubchannelWrapper : public SubchannelInterface { |
|
|
|
|
parent_(std::move(parent)), |
|
|
|
|
last_seen_state_(initial_state) {} |
|
|
|
|
|
|
|
|
|
~WatcherWrapper() { parent_.reset(DEBUG_LOCATION, "WatcherWrapper"); } |
|
|
|
|
~WatcherWrapper() { |
|
|
|
|
auto* parent = parent_.release(); /* ref owned by lambda */ |
|
|
|
|
parent->chand_->work_serializer_->Run( |
|
|
|
|
[parent]() { parent->Unref(DEBUG_LOCATION, "WatcherWrapper"); }, |
|
|
|
|
DEBUG_LOCATION); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void OnConnectivityStateChange( |
|
|
|
|
grpc_connectivity_state new_state, |
|
|
|
|