aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/cpp/server/channelz/channelz_service.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/cpp/server/channelz/channelz_service.cc')
-rw-r--r--src/cpp/server/channelz/channelz_service.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/cpp/server/channelz/channelz_service.cc b/src/cpp/server/channelz/channelz_service.cc
index e096c1f421..4e3fe8c1c9 100644
--- a/src/cpp/server/channelz/channelz_service.cc
+++ b/src/cpp/server/channelz/channelz_service.cc
@@ -92,4 +92,21 @@ Status ChannelzService::GetSubchannel(
return Status::OK;
}
+Status ChannelzService::GetSocket(ServerContext* unused,
+ const channelz::v1::GetSocketRequest* request,
+ channelz::v1::GetSocketResponse* response) {
+ char* json_str = grpc_channelz_get_socket(request->socket_id());
+ gpr_log(GPR_ERROR, "%s", json_str);
+ if (json_str == nullptr) {
+ return Status(NOT_FOUND, "No object found for that SocketId");
+ }
+ google::protobuf::util::Status s =
+ google::protobuf::util::JsonStringToMessage(json_str, response);
+ gpr_free(json_str);
+ if (s != google::protobuf::util::Status::OK) {
+ return Status(INTERNAL, s.ToString());
+ }
+ return Status::OK;
+}
+
} // namespace grpc