aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/ext/transport
diff options
context:
space:
mode:
authorGravatar ncteisen <ncteisen@gmail.com>2018-10-31 08:54:08 -0700
committerGravatar ncteisen <ncteisen@gmail.com>2018-10-31 09:13:44 -0700
commit1e64fa629c75ec2cf3be6dd40985f9517c4d33bc (patch)
tree7c2c7e565a886a8fb2bec0f4307e542e10ea606f /src/core/ext/transport
parent48c3c964b1c39cd5e0b85387ac85df38bb9db67b (diff)
Add AddressType
Diffstat (limited to 'src/core/ext/transport')
-rw-r--r--src/core/ext/transport/chttp2/transport/chttp2_transport.cc14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc
index 5168e4555e..0179831328 100644
--- a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc
+++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc
@@ -397,11 +397,14 @@ static bool read_channel_args(grpc_chttp2_transport* t,
}
}
if (channelz_enabled) {
+ grpc_core::channelz::SocketAddress remote;
+ grpc_core::channelz::SocketAddress local;
char* host = nullptr;
int port_num = -1;
// try to pick out just the host port (maybe trims off scheme prefix).
grpc_uri* uri = grpc_uri_parse(t->peer_string, true);
// if peer string was a valid URI, we can use our lib to do the trimming.
+ // TODO(ncteisen): handle UDS address.
if (uri != nullptr) {
const char* host_port = uri->path;
if (*host_port == '/') ++host_port;
@@ -410,15 +413,22 @@ static bool read_channel_args(grpc_chttp2_transport* t,
if (port != nullptr) {
port_num = atoi(port);
}
+ remote.set_blob(gpr_string_base64_encode(host));
+ remote.set_port(port_num);
+ remote.set_type(
+ grpc_core::channelz::SocketAddress::AddressType::kTcpAddress);
+ gpr_free(host);
gpr_free(port);
} else {
// if peer string is not a valid URI, just use the entire string to
// surface that info.
- host = gpr_strdup(t->peer_string);
+ remote.set_blob(gpr_strdup(t->peer_string));
+ remote.set_type(grpc_core::channelz::SocketAddress::AddressType::
+ kDirectChannelAddress);
}
t->channelz_socket =
grpc_core::MakeRefCounted<grpc_core::channelz::SocketNode>(
- grpc_core::UniquePtr<char>(host), port_num);
+ std::move(local), std::move(remote));
grpc_uri_destroy(uri);
}
return enable_bdp;