aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/iomgr/endpoint_pair_posix.c
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2015-06-01 17:04:17 -0700
committerGravatar Craig Tiller <ctiller@google.com>2015-06-01 17:04:17 -0700
commit8e0b08a33d819d0a2523ec439d545296e1ad2086 (patch)
tree5613a61a51db9c5a5f7ecc5fec8cfd0eb0b2c436 /src/core/iomgr/endpoint_pair_posix.c
parent3c1331f920569ba3a182e13321db26796d6e920e (diff)
parentfa275a97b968060383fe27c26b1d85f08d9582f9 (diff)
Merge branch 'count-the-things' into we-dont-need-no-backup
Diffstat (limited to 'src/core/iomgr/endpoint_pair_posix.c')
-rw-r--r--src/core/iomgr/endpoint_pair_posix.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/core/iomgr/endpoint_pair_posix.c b/src/core/iomgr/endpoint_pair_posix.c
index ac511b97b2..9b3b63f1e7 100644
--- a/src/core/iomgr/endpoint_pair_posix.c
+++ b/src/core/iomgr/endpoint_pair_posix.c
@@ -44,6 +44,8 @@
#include <sys/socket.h>
#include "src/core/iomgr/tcp_posix.h"
+#include "src/core/support/string.h"
+#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
static void create_sockets(int sv[2]) {
@@ -55,12 +57,21 @@ static void create_sockets(int sv[2]) {
GPR_ASSERT(fcntl(sv[1], F_SETFL, flags | O_NONBLOCK) == 0);
}
-grpc_endpoint_pair grpc_iomgr_create_endpoint_pair(size_t read_slice_size) {
+grpc_endpoint_pair grpc_iomgr_create_endpoint_pair(const char *name,
+ size_t read_slice_size) {
int sv[2];
grpc_endpoint_pair p;
+ char *final_name;
create_sockets(sv);
- p.client = grpc_tcp_create(grpc_fd_create(sv[1]), read_slice_size);
- p.server = grpc_tcp_create(grpc_fd_create(sv[0]), read_slice_size);
+
+ gpr_asprintf(&final_name, "%s:client", name);
+ p.client =
+ grpc_tcp_create(grpc_fd_create(sv[1], final_name), read_slice_size);
+ gpr_free(final_name);
+ gpr_asprintf(&final_name, "%s:server", name);
+ p.server =
+ grpc_tcp_create(grpc_fd_create(sv[0], final_name), read_slice_size);
+ gpr_free(final_name);
return p;
}