Skip to content
Snippets Groups Projects
Commit 68413c22 authored by Yuchen Zeng's avatar Yuchen Zeng
Browse files

Remove GRPC_SOCKET

parent e5ec9ac9
No related branches found
No related tags found
No related merge requests found
......@@ -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);
}
......@@ -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);
......
......@@ -41,6 +41,4 @@
#include <sys/types.h>
#include <unistd.h>
typedef int GRPC_SOCKET;
#endif /* GRPC_CORE_LIB_IOMGR_SOCKADDR_POSIX_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 */
......@@ -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) {
......
......@@ -366,9 +366,7 @@ static char *endpoint_get_peer(grpc_endpoint *secure_ep) {
return grpc_endpoint_get_peer(ep->wrapped_ep);
}
static GRPC_SOCKET *endpoint_get_socket(grpc_endpoint *secure_ep) {
return NULL;
}
static int endpoint_get_fd(grpc_endpoint *secure_ep) { return -1; }
static grpc_workqueue *endpoint_get_workqueue(grpc_endpoint *secure_ep) {
secure_endpoint *ep = (secure_endpoint *)secure_ep;
......@@ -383,7 +381,7 @@ static const grpc_endpoint_vtable vtable = {endpoint_read,
endpoint_shutdown,
endpoint_destroy,
endpoint_get_peer,
endpoint_get_socket};
endpoint_get_fd};
grpc_endpoint *grpc_secure_endpoint_create(
struct tsi_frame_protector *protector, grpc_endpoint *transport,
......
......@@ -85,7 +85,7 @@ static void test_code(void) {
grpc_endpoint_shutdown,
grpc_endpoint_destroy,
grpc_endpoint_get_peer,
grpc_endpoint_get_socket};
grpc_endpoint_get_fd};
endpoint.vtable = &vtable;
grpc_endpoint_read(&exec_ctx, &endpoint, NULL, NULL);
......
......@@ -96,7 +96,7 @@ static char *me_get_peer(grpc_endpoint *ep) {
return gpr_strdup("fake:mock_endpoint");
}
static GRPC_SOCKET *me_get_socket(grpc_endpoint *ep) { return NULL; }
static int me_get_fd(grpc_endpoint *ep) { return -1; }
static grpc_workqueue *me_get_workqueue(grpc_endpoint *ep) { return NULL; }
......@@ -108,7 +108,7 @@ static const grpc_endpoint_vtable vtable = {me_read,
me_shutdown,
me_destroy,
me_get_peer,
me_get_socket};
me_get_fd};
grpc_endpoint *grpc_mock_endpoint_create(void (*on_write)(gpr_slice slice)) {
grpc_mock_endpoint *m = gpr_malloc(sizeof(*m));
......
......@@ -141,7 +141,7 @@ static char *me_get_peer(grpc_endpoint *ep) {
return gpr_strdup("fake:mock_endpoint");
}
static GRPC_SOCKET *me_get_socket(grpc_endpoint *ep) { return NULL; }
static int me_get_fd(grpc_endpoint *ep) { return -1; }
static grpc_workqueue *me_get_workqueue(grpc_endpoint *ep) { return NULL; }
......@@ -153,7 +153,7 @@ static const grpc_endpoint_vtable vtable = {me_read,
me_shutdown,
me_destroy,
me_get_peer,
me_get_socket};
me_get_fd};
static void half_init(half *m, passthru_endpoint *parent) {
m->base.vtable = &vtable;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment