diff options
Diffstat (limited to 'src/core/lib/iomgr')
-rw-r--r-- | src/core/lib/iomgr/endpoint.c | 2 | ||||
-rw-r--r-- | src/core/lib/iomgr/endpoint.h | 9 | ||||
-rw-r--r-- | src/core/lib/iomgr/sockaddr_posix.h | 2 | ||||
-rw-r--r-- | src/core/lib/iomgr/sockaddr_windows.h | 2 | ||||
-rw-r--r-- | src/core/lib/iomgr/tcp_posix.c | 6 |
5 files changed, 9 insertions, 12 deletions
diff --git a/src/core/lib/iomgr/endpoint.c b/src/core/lib/iomgr/endpoint.c index f901fcf962..e70b5599a1 100644 --- a/src/core/lib/iomgr/endpoint.c +++ b/src/core/lib/iomgr/endpoint.c @@ -66,6 +66,8 @@ char* grpc_endpoint_get_peer(grpc_endpoint* ep) { return ep->vtable->get_peer(ep); } +int grpc_endpoint_get_fd(grpc_endpoint* ep) { return ep->vtable->get_fd(ep); } + grpc_workqueue* grpc_endpoint_get_workqueue(grpc_endpoint* ep) { return ep->vtable->get_workqueue(ep); } diff --git a/src/core/lib/iomgr/endpoint.h b/src/core/lib/iomgr/endpoint.h index 22979982e4..2fa59cfc07 100644 --- a/src/core/lib/iomgr/endpoint.h +++ b/src/core/lib/iomgr/endpoint.h @@ -39,7 +39,6 @@ #include <grpc/support/time.h> #include "src/core/lib/iomgr/pollset.h" #include "src/core/lib/iomgr/pollset_set.h" -#include "src/core/lib/iomgr/sockaddr.h" /* An endpoint caps a streaming channel between two communicating processes. Examples may be: a tcp socket, <stdin+stdout>, or some shared memory. */ @@ -60,7 +59,7 @@ struct grpc_endpoint_vtable { void (*shutdown)(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep); void (*destroy)(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep); char *(*get_peer)(grpc_endpoint *ep); - GRPC_SOCKET *(*get_socket)(grpc_endpoint *ep); + int (*get_fd)(grpc_endpoint *ep); }; /* When data is available on the connection, calls the callback with slices. @@ -73,9 +72,9 @@ void grpc_endpoint_read(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, char *grpc_endpoint_get_peer(grpc_endpoint *ep); -/* Get the socket (file descriptor or SOCKET) used by \a ep. Return NULL if - \a ep is not using a socket. */ -GRPC_SOCKET *grpc_endpoint_get_socket(grpc_endpoint *ep); +/* Get the file descriptor used by \a ep. Return -1 if \a ep is not using a fd. + */ +int grpc_endpoint_get_fd(grpc_endpoint *ep); /* Retrieve a reference to the workqueue associated with this endpoint */ grpc_workqueue *grpc_endpoint_get_workqueue(grpc_endpoint *ep); diff --git a/src/core/lib/iomgr/sockaddr_posix.h b/src/core/lib/iomgr/sockaddr_posix.h index a4236ffaee..b150de42f7 100644 --- a/src/core/lib/iomgr/sockaddr_posix.h +++ b/src/core/lib/iomgr/sockaddr_posix.h @@ -41,6 +41,4 @@ #include <sys/types.h> #include <unistd.h> -typedef int GRPC_SOCKET; - #endif /* GRPC_CORE_LIB_IOMGR_SOCKADDR_POSIX_H */ diff --git a/src/core/lib/iomgr/sockaddr_windows.h b/src/core/lib/iomgr/sockaddr_windows.h index 507fc71f63..971db5b32b 100644 --- a/src/core/lib/iomgr/sockaddr_windows.h +++ b/src/core/lib/iomgr/sockaddr_windows.h @@ -40,6 +40,4 @@ // must be included after the above #include <mswsock.h> -typedef SOCKET GRPC_SOCKET; - #endif /* GRPC_CORE_LIB_IOMGR_SOCKADDR_WINDOWS_H */ diff --git a/src/core/lib/iomgr/tcp_posix.c b/src/core/lib/iomgr/tcp_posix.c index 5ed00a8e98..73e28ef5dd 100644 --- a/src/core/lib/iomgr/tcp_posix.c +++ b/src/core/lib/iomgr/tcp_posix.c @@ -464,9 +464,9 @@ static char *tcp_get_peer(grpc_endpoint *ep) { return gpr_strdup(tcp->peer_string); } -static int *tcp_get_socket(grpc_endpoint *ep) { +static int tcp_get_fd(grpc_endpoint *ep) { grpc_tcp *tcp = (grpc_tcp *)ep; - return &tcp->fd; + return tcp->fd; } static grpc_workqueue *tcp_get_workqueue(grpc_endpoint *ep) { @@ -482,7 +482,7 @@ static const grpc_endpoint_vtable vtable = {tcp_read, tcp_shutdown, tcp_destroy, tcp_get_peer, - tcp_get_socket}; + tcp_get_fd}; grpc_endpoint *grpc_tcp_create(grpc_fd *em_fd, size_t slice_size, const char *peer_string) { |