From 808ac3872427f1b2cd7eadd2a595825c5e0ceb2e Mon Sep 17 00:00:00 2001 From: "Mark D. Roth" Date: Fri, 13 May 2016 11:14:21 -0700 Subject: [PATCH] Fixed endpoint tests. --- src/core/lib/iomgr/tcp_posix.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/core/lib/iomgr/tcp_posix.c b/src/core/lib/iomgr/tcp_posix.c index 766a9762771..4994d944c91 100644 --- a/src/core/lib/iomgr/tcp_posix.c +++ b/src/core/lib/iomgr/tcp_posix.c @@ -38,6 +38,7 @@ #include "src/core/lib/iomgr/tcp_posix.h" #include +#include #include #include #include @@ -74,7 +75,7 @@ typedef struct { grpc_endpoint base; grpc_fd *em_fd; int fd; - int finished_edge; + bool finished_edge; msg_iovlen_type iov_size; /* Number of slices to allocate per read attempt */ size_t slice_size; gpr_refcount refcount; @@ -273,7 +274,7 @@ static void tcp_read(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, gpr_slice_buffer_swap(incoming_buffer, &tcp->last_read_buffer); TCP_REF(tcp, "read"); if (tcp->finished_edge) { - tcp->finished_edge = 0; + tcp->finished_edge = false; grpc_fd_notify_on_read(exec_ctx, tcp->em_fd, &tcp->read_closure); } else { grpc_exec_ctx_push(exec_ctx, &tcp->read_closure, GRPC_ERROR_NONE, NULL); @@ -370,7 +371,7 @@ static void tcp_handle_write(grpc_exec_ctx *exec_ctx, void *arg /* grpc_tcp */, if (error != GRPC_ERROR_NONE) { cb = tcp->write_cb; tcp->write_cb = NULL; - cb->cb(exec_ctx, cb->cb_arg, 0); + cb->cb(exec_ctx, cb->cb_arg, GRPC_ERROR_REF(error)); TCP_UNREF(exec_ctx, tcp, "write"); return; } @@ -381,7 +382,7 @@ static void tcp_handle_write(grpc_exec_ctx *exec_ctx, void *arg /* grpc_tcp */, cb = tcp->write_cb; tcp->write_cb = NULL; GPR_TIMER_BEGIN("tcp_handle_write.cb", 0); - cb->cb(exec_ctx, cb->cb_arg, error); + cb->cb(exec_ctx, cb->cb_arg, GRPC_ERROR_REF(error)); GPR_TIMER_END("tcp_handle_write.cb", 0); TCP_UNREF(exec_ctx, tcp, "write"); } @@ -460,7 +461,7 @@ grpc_endpoint *grpc_tcp_create(grpc_fd *em_fd, size_t slice_size, tcp->incoming_buffer = NULL; tcp->slice_size = slice_size; tcp->iov_size = 1; - tcp->finished_edge = 1; + tcp->finished_edge = true; /* paired with unref in grpc_tcp_destroy */ gpr_ref_init(&tcp->refcount, 1); tcp->em_fd = em_fd;