|
|
|
@ -303,9 +303,7 @@ void ChannelNode::RemoveChildSubchannel(intptr_t child_uuid) { |
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
ServerNode::ServerNode(grpc_server* server, size_t channel_tracer_max_nodes) |
|
|
|
|
: BaseNode(EntityType::kServer), |
|
|
|
|
server_(server), |
|
|
|
|
trace_(channel_tracer_max_nodes) {} |
|
|
|
|
: BaseNode(EntityType::kServer), trace_(channel_tracer_max_nodes) {} |
|
|
|
|
|
|
|
|
|
ServerNode::~ServerNode() {} |
|
|
|
|
|
|
|
|
@ -319,6 +317,16 @@ void ServerNode::RemoveChildSocket(intptr_t child_uuid) { |
|
|
|
|
child_sockets_.erase(child_uuid); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void ServerNode::AddChildListenSocket(intptr_t child_uuid) { |
|
|
|
|
MutexLock lock(&child_mu_); |
|
|
|
|
child_listen_sockets_.insert(MakePair(child_uuid, true)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void ServerNode::RemoveChildListenSocket(intptr_t child_uuid) { |
|
|
|
|
MutexLock lock(&child_mu_); |
|
|
|
|
child_listen_sockets_.erase(child_uuid); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
char* ServerNode::RenderServerSockets(intptr_t start_socket_id, |
|
|
|
|
intptr_t max_results) { |
|
|
|
|
// If user does not set max_results, we choose 500.
|
|
|
|
@ -382,17 +390,17 @@ grpc_json* ServerNode::RenderJson() { |
|
|
|
|
// ask CallCountingHelper to populate trace and call count data.
|
|
|
|
|
call_counter_.PopulateCallCounts(json); |
|
|
|
|
json = top_level_json; |
|
|
|
|
ChildRefsList listen_sockets; |
|
|
|
|
grpc_server_populate_listen_sockets(server_, &listen_sockets); |
|
|
|
|
if (!listen_sockets.empty()) { |
|
|
|
|
// Render listen sockets
|
|
|
|
|
MutexLock lock(&child_mu_); |
|
|
|
|
if (!child_listen_sockets_.empty()) { |
|
|
|
|
grpc_json* array_parent = grpc_json_create_child( |
|
|
|
|
nullptr, json, "listenSocket", nullptr, GRPC_JSON_ARRAY, false); |
|
|
|
|
for (size_t i = 0; i < listen_sockets.size(); ++i) { |
|
|
|
|
for (const auto& it : child_listen_sockets_) { |
|
|
|
|
json_iterator = |
|
|
|
|
grpc_json_create_child(json_iterator, array_parent, nullptr, nullptr, |
|
|
|
|
GRPC_JSON_OBJECT, false); |
|
|
|
|
grpc_json_add_number_string_child(json_iterator, nullptr, "socketId", |
|
|
|
|
listen_sockets[i]); |
|
|
|
|
it.first); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return top_level_json; |
|
|
|
|