Imported Upstream version 1.34.0
[platform/upstream/grpc.git] / test / core / util / passthru_endpoint.cc
index 0b14c55..e8a8fc5 100644 (file)
@@ -152,11 +152,18 @@ static void me_destroy(grpc_endpoint* ep) {
   }
 }
 
-static char* me_get_peer(grpc_endpoint* ep) {
+static absl::string_view me_get_peer(grpc_endpoint* ep) {
   passthru_endpoint* p = (reinterpret_cast<half*>(ep))->parent;
   return (reinterpret_cast<half*>(ep)) == &p->client
-             ? gpr_strdup("fake:mock_client_endpoint")
-             : gpr_strdup("fake:mock_server_endpoint");
+             ? "fake:mock_client_endpoint"
+             : "fake:mock_server_endpoint";
+}
+
+static absl::string_view me_get_local_address(grpc_endpoint* ep) {
+  passthru_endpoint* p = (reinterpret_cast<half*>(ep))->parent;
+  return (reinterpret_cast<half*>(ep)) == &p->client
+             ? "fake:mock_client_endpoint"
+             : "fake:mock_server_endpoint";
 }
 
 static int me_get_fd(grpc_endpoint* /*ep*/) { return -1; }
@@ -178,6 +185,7 @@ static const grpc_endpoint_vtable vtable = {
     me_destroy,
     me_get_resource_user,
     me_get_peer,
+    me_get_local_address,
     me_get_fd,
     me_can_track_err,
 };
@@ -201,7 +209,7 @@ void grpc_passthru_endpoint_create(grpc_endpoint** client,
   passthru_endpoint* m =
       static_cast<passthru_endpoint*>(gpr_malloc(sizeof(*m)));
   m->halves = 2;
-  m->shutdown = 0;
+  m->shutdown = false;
   if (stats == nullptr) {
     m->stats = grpc_passthru_endpoint_stats_create();
   } else {