|
|
@ -456,15 +456,17 @@ class ClientChannel::SubchannelWrapper : public SubchannelInterface { |
|
|
|
chand, this, subchannel_.get()); |
|
|
|
chand, this, subchannel_.get()); |
|
|
|
} |
|
|
|
} |
|
|
|
GRPC_CHANNEL_STACK_REF(chand_->owning_stack_, "SubchannelWrapper"); |
|
|
|
GRPC_CHANNEL_STACK_REF(chand_->owning_stack_, "SubchannelWrapper"); |
|
|
|
auto* subchannel_node = subchannel_->channelz_node(); |
|
|
|
if (chand_->channelz_node_ != nullptr) { |
|
|
|
if (subchannel_node != nullptr) { |
|
|
|
auto* subchannel_node = subchannel_->channelz_node(); |
|
|
|
auto it = chand_->subchannel_refcount_map_.find(subchannel_.get()); |
|
|
|
if (subchannel_node != nullptr) { |
|
|
|
if (it == chand_->subchannel_refcount_map_.end()) { |
|
|
|
auto it = chand_->subchannel_refcount_map_.find(subchannel_.get()); |
|
|
|
chand_->channelz_node_->AddChildSubchannel(subchannel_node->uuid()); |
|
|
|
if (it == chand_->subchannel_refcount_map_.end()) { |
|
|
|
it = chand_->subchannel_refcount_map_.emplace(subchannel_.get(), 0) |
|
|
|
chand_->channelz_node_->AddChildSubchannel(subchannel_node->uuid()); |
|
|
|
.first; |
|
|
|
it = chand_->subchannel_refcount_map_.emplace(subchannel_.get(), 0) |
|
|
|
|
|
|
|
.first; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
++it->second; |
|
|
|
} |
|
|
|
} |
|
|
|
++it->second; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
chand_->subchannel_wrappers_.insert(this); |
|
|
|
chand_->subchannel_wrappers_.insert(this); |
|
|
|
} |
|
|
|
} |
|
|
@ -476,14 +478,17 @@ class ClientChannel::SubchannelWrapper : public SubchannelInterface { |
|
|
|
chand_, this, subchannel_.get()); |
|
|
|
chand_, this, subchannel_.get()); |
|
|
|
} |
|
|
|
} |
|
|
|
chand_->subchannel_wrappers_.erase(this); |
|
|
|
chand_->subchannel_wrappers_.erase(this); |
|
|
|
auto* subchannel_node = subchannel_->channelz_node(); |
|
|
|
if (chand_->channelz_node_ != nullptr) { |
|
|
|
if (subchannel_node != nullptr) { |
|
|
|
auto* subchannel_node = subchannel_->channelz_node(); |
|
|
|
auto it = chand_->subchannel_refcount_map_.find(subchannel_.get()); |
|
|
|
if (subchannel_node != nullptr) { |
|
|
|
GPR_ASSERT(it != chand_->subchannel_refcount_map_.end()); |
|
|
|
auto it = chand_->subchannel_refcount_map_.find(subchannel_.get()); |
|
|
|
--it->second; |
|
|
|
GPR_ASSERT(it != chand_->subchannel_refcount_map_.end()); |
|
|
|
if (it->second == 0) { |
|
|
|
--it->second; |
|
|
|
chand_->channelz_node_->RemoveChildSubchannel(subchannel_node->uuid()); |
|
|
|
if (it->second == 0) { |
|
|
|
chand_->subchannel_refcount_map_.erase(it); |
|
|
|
chand_->channelz_node_->RemoveChildSubchannel( |
|
|
|
|
|
|
|
subchannel_node->uuid()); |
|
|
|
|
|
|
|
chand_->subchannel_refcount_map_.erase(it); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
GRPC_CHANNEL_STACK_UNREF(chand_->owning_stack_, "SubchannelWrapper"); |
|
|
|
GRPC_CHANNEL_STACK_UNREF(chand_->owning_stack_, "SubchannelWrapper"); |
|
|
|