aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/lib/channel
diff options
context:
space:
mode:
authorGravatar ncteisen <ncteisen@gmail.com>2018-10-16 13:55:52 -0700
committerGravatar ncteisen <ncteisen@gmail.com>2018-10-16 13:55:52 -0700
commit8fe64be062a7b365926d6dded68988601e6d4d31 (patch)
treecf1ccbd8b4658af7d0e30cb380404dc60e5bf310 /src/core/lib/channel
parent7380707fd37a6812a1b6ce9f4be1aa8e3ebea928 (diff)
Incorperate uuid into channel and server socket lookup
Diffstat (limited to 'src/core/lib/channel')
-rw-r--r--src/core/lib/channel/channelz_registry.cc19
1 files changed, 6 insertions, 13 deletions
diff --git a/src/core/lib/channel/channelz_registry.cc b/src/core/lib/channel/channelz_registry.cc
index e90a9e1f7f..218e3e2094 100644
--- a/src/core/lib/channel/channelz_registry.cc
+++ b/src/core/lib/channel/channelz_registry.cc
@@ -131,16 +131,12 @@ char* ChannelzRegistry::InternalGetTopChannels(intptr_t start_channel_id) {
grpc_json* json = top_level_json;
grpc_json* json_iterator = nullptr;
InlinedVector<BaseNode*, 10> top_level_channels;
- // uuids index into entities one-off (idx 0 is really uuid 1, since 0 is
- // reserved). However, we want to support requests coming in with
- // start_channel_id=0, which signifies "give me everything." Hence this
- // funky looking line below.
- size_t start_idx = start_channel_id == 0 ? 0 : start_channel_id - 1;
bool reached_pagination_limit = false;
- for (size_t i = start_idx; i < entities_.size(); ++i) {
+ for (size_t i = 0; i < entities_.size(); ++i) {
if (entities_[i] != nullptr &&
entities_[i]->type() ==
- grpc_core::channelz::BaseNode::EntityType::kTopLevelChannel) {
+ grpc_core::channelz::BaseNode::EntityType::kTopLevelChannel &&
+ entities_[i]->uuid() >= start_channel_id) {
// check if we are over pagination limit to determine if we need to set
// the "end" element. If we don't go through this block, we know that
// when the loop terminates, we have <= to kPaginationLimit.
@@ -176,15 +172,12 @@ char* ChannelzRegistry::InternalGetServers(intptr_t start_server_id) {
grpc_json* json = top_level_json;
grpc_json* json_iterator = nullptr;
InlinedVector<BaseNode*, 10> servers;
- // uuids index into entities one-off (idx 0 is really uuid 1, since 0 is
- // reserved). However, we want to support requests coming in with
- // start_server_id=0, which signifies "give me everything."
- size_t start_idx = start_server_id == 0 ? 0 : start_server_id - 1;
bool reached_pagination_limit = false;
- for (size_t i = start_idx; i < entities_.size(); ++i) {
+ for (size_t i = 0; i < entities_.size(); ++i) {
if (entities_[i] != nullptr &&
entities_[i]->type() ==
- grpc_core::channelz::BaseNode::EntityType::kServer) {
+ grpc_core::channelz::BaseNode::EntityType::kServer &&
+ entities_[i]->uuid() >= start_server_id) {
// check if we are over pagination limit to determine if we need to set
// the "end" element. If we don't go through this block, we know that
// when the loop terminates, we have <= to kPaginationLimit.