From 3c72a939fce12756a88511e88c092b983ac9649e Mon Sep 17 00:00:00 2001 From: Hope Casey-Allen Date: Tue, 25 Jun 2019 15:39:16 -0700 Subject: [PATCH] Remove subchannel_destroyed_ --- .../ext/filters/client_channel/client_channel_channelz.cc | 7 +------ .../ext/filters/client_channel/client_channel_channelz.h | 6 ------ src/core/ext/filters/client_channel/subchannel.cc | 2 +- 3 files changed, 2 insertions(+), 13 deletions(-) diff --git a/src/core/ext/filters/client_channel/client_channel_channelz.cc b/src/core/ext/filters/client_channel/client_channel_channelz.cc index fb7d1cbbc16..f21d45d8c0f 100644 --- a/src/core/ext/filters/client_channel/client_channel_channelz.cc +++ b/src/core/ext/filters/client_channel/client_channel_channelz.cc @@ -33,7 +33,6 @@ namespace channelz { SubchannelNode::SubchannelNode(const char* target_address, size_t channel_tracer_max_nodes) : BaseNode(EntityType::kSubchannel), - subchannel_destroyed_(false), target_(UniquePtr(gpr_strdup(target_address))), trace_(channel_tracer_max_nodes) {} @@ -49,11 +48,7 @@ void SubchannelNode::SetChildSocketUuid(intptr_t uuid) { void SubchannelNode::PopulateConnectivityState(grpc_json* json) { grpc_connectivity_state state; - if (subchannel_destroyed_) { - state = GRPC_CHANNEL_SHUTDOWN; - } else { - state = connectivity_state_.Load(MemoryOrder::RELAXED); - } + state = connectivity_state_.Load(MemoryOrder::RELAXED); json = grpc_json_create_child(nullptr, json, "state", nullptr, GRPC_JSON_OBJECT, false); grpc_json_create_child(nullptr, json, "state", diff --git a/src/core/ext/filters/client_channel/client_channel_channelz.h b/src/core/ext/filters/client_channel/client_channel_channelz.h index 34b8e269a2e..b9eaec7e0c5 100644 --- a/src/core/ext/filters/client_channel/client_channel_channelz.h +++ b/src/core/ext/filters/client_channel/client_channel_channelz.h @@ -37,11 +37,6 @@ class SubchannelNode : public BaseNode { SubchannelNode(const char* target_address, size_t channel_tracer_max_nodes); ~SubchannelNode() override; - void MarkSubchannelDestroyed() { - GPR_ASSERT(!subchannel_destroyed_); - subchannel_destroyed_ = true; - } - // Used when the subchannel's transport connectivity state changes. void UpdateConnectivityState(grpc_connectivity_state state); @@ -70,7 +65,6 @@ class SubchannelNode : public BaseNode { private: void PopulateConnectivityState(grpc_json* json); - bool subchannel_destroyed_; Atomic connectivity_state_{GRPC_CHANNEL_IDLE}; Atomic child_socket_uuid_{0}; UniquePtr target_; diff --git a/src/core/ext/filters/client_channel/subchannel.cc b/src/core/ext/filters/client_channel/subchannel.cc index 28fe6d87c6d..9a6655e45d6 100644 --- a/src/core/ext/filters/client_channel/subchannel.cc +++ b/src/core/ext/filters/client_channel/subchannel.cc @@ -691,7 +691,7 @@ Subchannel::~Subchannel() { channelz_node_->AddTraceEvent( channelz::ChannelTrace::Severity::Info, grpc_slice_from_static_string("Subchannel destroyed")); - channelz_node_->MarkSubchannelDestroyed(); + channelz_node_->UpdateConnectivityState(GRPC_CHANNEL_SHUTDOWN); } grpc_channel_args_destroy(args_); grpc_connector_unref(connector_);