|
|
|
@ -30,6 +30,7 @@ |
|
|
|
|
|
|
|
|
|
#include "src/core/lib/channel/channelz_registry.h" |
|
|
|
|
#include "src/core/lib/channel/status_util.h" |
|
|
|
|
#include "src/core/lib/gpr/host_port.h" |
|
|
|
|
#include "src/core/lib/gpr/string.h" |
|
|
|
|
#include "src/core/lib/gpr/useful.h" |
|
|
|
|
#include "src/core/lib/gprpp/memory.h" |
|
|
|
@ -277,7 +278,20 @@ grpc_json* ServerNode::RenderJson() { |
|
|
|
|
return top_level_json; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
SocketNode::SocketNode() : BaseNode(EntityType::kSocket) {} |
|
|
|
|
SocketNode::SocketNode(const char* remote_peer_string) |
|
|
|
|
: BaseNode(EntityType::kSocket) { |
|
|
|
|
const char* ipv6_prefix = "ipv6:"; |
|
|
|
|
const int ipv6_prefix_len = 5; |
|
|
|
|
char* host; |
|
|
|
|
char* port; |
|
|
|
|
int offset = (strncmp(remote_peer_string, ipv6_prefix, ipv6_prefix_len) == 0) |
|
|
|
|
? ipv6_prefix_len |
|
|
|
|
: 0; |
|
|
|
|
GPR_ASSERT(gpr_split_host_port(remote_peer_string + offset, &host, &port)); |
|
|
|
|
remote_host_ = UniquePtr<char>(host); |
|
|
|
|
remote_port_ = atoi(port); |
|
|
|
|
gpr_free(port); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void SocketNode::RecordStreamStartedFromLocal() { |
|
|
|
|
gpr_atm_no_barrier_fetch_add(&streams_started_, static_cast<gpr_atm>(1)); |
|
|
|
@ -315,6 +329,21 @@ grpc_json* SocketNode::RenderJson() { |
|
|
|
|
json_iterator = nullptr; |
|
|
|
|
json_iterator = grpc_json_add_number_string_child(json, json_iterator, |
|
|
|
|
"socketId", uuid()); |
|
|
|
|
json = top_level_json; |
|
|
|
|
json_iterator = nullptr; |
|
|
|
|
json_iterator = grpc_json_create_child(json_iterator, json, "remote", nullptr, |
|
|
|
|
GRPC_JSON_OBJECT, false); |
|
|
|
|
json = json_iterator; |
|
|
|
|
json_iterator = nullptr; |
|
|
|
|
json_iterator = grpc_json_create_child(json_iterator, json, "tcpip_address", |
|
|
|
|
nullptr, GRPC_JSON_OBJECT, false); |
|
|
|
|
json = json_iterator; |
|
|
|
|
json_iterator = nullptr; |
|
|
|
|
json_iterator = grpc_json_add_number_string_child(json, json_iterator, "port", |
|
|
|
|
remote_port_); |
|
|
|
|
json_iterator = |
|
|
|
|
grpc_json_create_child(json_iterator, json, "ip_address", |
|
|
|
|
remote_host_.get(), GRPC_JSON_STRING, false); |
|
|
|
|
// reset json iterators to top level object
|
|
|
|
|
json = top_level_json; |
|
|
|
|
json_iterator = nullptr; |
|
|
|
|