From a8e2e5263db11e7946e2b7fc249a94cca0f49089 Mon Sep 17 00:00:00 2001 From: Robbie Shade Date: Tue, 29 Sep 2015 14:19:45 -0400 Subject: [PATCH] Pass through grpc_fd pointer rather than int. --- src/core/iomgr/udp_server.c | 2 +- src/core/iomgr/udp_server.h | 2 +- test/core/iomgr/udp_server_test.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core/iomgr/udp_server.c b/src/core/iomgr/udp_server.c index 9baaf1edc78..d884359aa43 100644 --- a/src/core/iomgr/udp_server.c +++ b/src/core/iomgr/udp_server.c @@ -278,7 +278,7 @@ static void on_read(grpc_exec_ctx *exec_ctx, void *arg, int success) { /* Tell the registered callback that data is available to read. */ GPR_ASSERT(sp->read_cb); - sp->read_cb(sp->fd, sp->server->grpc_server); + sp->read_cb(sp->emfd, sp->server->grpc_server); /* Re-arm the notification event so we get another chance to read. */ grpc_fd_notify_on_read(exec_ctx, sp->emfd, &sp->read_closure); diff --git a/src/core/iomgr/udp_server.h b/src/core/iomgr/udp_server.h index 8e3abae864b..dbbe0971093 100644 --- a/src/core/iomgr/udp_server.h +++ b/src/core/iomgr/udp_server.h @@ -43,7 +43,7 @@ typedef struct grpc_server grpc_server; typedef struct grpc_udp_server grpc_udp_server; /* Called when data is available to read from the socket. */ -typedef void (*grpc_udp_server_read_cb)(int fd, grpc_server *server); +typedef void (*grpc_udp_server_read_cb)(grpc_fd *emfd, grpc_server *server); /* Create a server, initially not bound to any ports */ grpc_udp_server *grpc_udp_server_create(void); diff --git a/test/core/iomgr/udp_server_test.c b/test/core/iomgr/udp_server_test.c index 6d3dfeeb57c..fc0026da4df 100644 --- a/test/core/iomgr/udp_server_test.c +++ b/test/core/iomgr/udp_server_test.c @@ -49,12 +49,12 @@ static grpc_pollset g_pollset; static int g_number_of_reads = 0; static int g_number_of_bytes_read = 0; -static void on_read(int fd, grpc_server *server) { +static void on_read(grpc_fd *emfd, grpc_server *server) { char read_buffer[512]; ssize_t byte_count; gpr_mu_lock(GRPC_POLLSET_MU(&g_pollset)); - byte_count = recv(fd, read_buffer, sizeof(read_buffer), 0); + byte_count = recv(emfd->fd, read_buffer, sizeof(read_buffer), 0); g_number_of_reads++; g_number_of_bytes_read += (int)byte_count;