From eced8ae3b3aeb2f9f870d0dab215c37ca57ca9ba Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 28 Jan 2016 14:13:20 -0800 Subject: [PATCH] Fix windows --- src/core/iomgr/iocp_windows.c | 4 ++-- src/core/iomgr/pollset_windows.c | 4 ++-- src/core/iomgr/resolve_address_windows.c | 2 +- src/core/iomgr/tcp_client_windows.c | 6 +++--- src/core/iomgr/tcp_server_windows.c | 6 +++--- src/core/iomgr/tcp_windows.c | 20 ++++++++++---------- test/core/util/port_windows.c | 2 +- 7 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/core/iomgr/iocp_windows.c b/src/core/iomgr/iocp_windows.c index 6cbe7d2fd47..96b6f810248 100644 --- a/src/core/iomgr/iocp_windows.c +++ b/src/core/iomgr/iocp_windows.c @@ -120,7 +120,7 @@ void grpc_iocp_work(grpc_exec_ctx *exec_ctx, gpr_timespec deadline) { info->has_pending_iocp = 1; } gpr_mu_unlock(&socket->state_mu); - grpc_exec_ctx_enqueue(exec_ctx, closure, 1); + grpc_exec_ctx_enqueue(exec_ctx, closure, true, NULL); } void grpc_iocp_init(void) { @@ -183,7 +183,7 @@ static void socket_notify_on_iocp(grpc_exec_ctx *exec_ctx, gpr_mu_lock(&socket->state_mu); if (info->has_pending_iocp) { info->has_pending_iocp = 0; - grpc_exec_ctx_enqueue(exec_ctx, closure, 1); + grpc_exec_ctx_enqueue(exec_ctx, closure, true, NULL); } else { info->closure = closure; } diff --git a/src/core/iomgr/pollset_windows.c b/src/core/iomgr/pollset_windows.c index bfd9e69a162..2e650ca9393 100644 --- a/src/core/iomgr/pollset_windows.c +++ b/src/core/iomgr/pollset_windows.c @@ -107,7 +107,7 @@ void grpc_pollset_shutdown(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset, pollset->shutting_down = 1; grpc_pollset_kick(pollset, GRPC_POLLSET_KICK_BROADCAST); if (!pollset->is_iocp_worker) { - grpc_exec_ctx_enqueue(exec_ctx, closure, 1); + grpc_exec_ctx_enqueue(exec_ctx, closure, true, NULL); } else { pollset->on_shutdown = closure; } @@ -165,7 +165,7 @@ void grpc_pollset_work(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset, } if (pollset->shutting_down && pollset->on_shutdown != NULL) { - grpc_exec_ctx_enqueue(exec_ctx, pollset->on_shutdown, 1); + grpc_exec_ctx_enqueue(exec_ctx, pollset->on_shutdown, true, NULL); pollset->on_shutdown = NULL; } goto done; diff --git a/src/core/iomgr/resolve_address_windows.c b/src/core/iomgr/resolve_address_windows.c index 007c855d109..7a6f8a2f8b8 100644 --- a/src/core/iomgr/resolve_address_windows.c +++ b/src/core/iomgr/resolve_address_windows.c @@ -135,7 +135,7 @@ done: /* Callback to be passed to grpc_executor to asynch-ify * grpc_blocking_resolve_address */ -static void do_request_thread(grpc_exec_ctx *exec_ctx, void *rp, int success) { +static void do_request_thread(grpc_exec_ctx *exec_ctx, void *rp, bool success) { request *r = rp; grpc_resolved_addresses *resolved = grpc_blocking_resolve_address(r->name, r->default_port); diff --git a/src/core/iomgr/tcp_client_windows.c b/src/core/iomgr/tcp_client_windows.c index e5691b7e121..1eac82a08d6 100644 --- a/src/core/iomgr/tcp_client_windows.c +++ b/src/core/iomgr/tcp_client_windows.c @@ -74,7 +74,7 @@ static void async_connect_unlock_and_cleanup(async_connect *ac) { } } -static void on_alarm(grpc_exec_ctx *exec_ctx, void *acp, int occured) { +static void on_alarm(grpc_exec_ctx *exec_ctx, void *acp, bool occured) { async_connect *ac = acp; gpr_mu_lock(&ac->mu); /* If the alarm didn't occur, it got cancelled. */ @@ -84,7 +84,7 @@ static void on_alarm(grpc_exec_ctx *exec_ctx, void *acp, int occured) { async_connect_unlock_and_cleanup(ac); } -static void on_connect(grpc_exec_ctx *exec_ctx, void *acp, int from_iocp) { +static void on_connect(grpc_exec_ctx *exec_ctx, void *acp, bool from_iocp) { async_connect *ac = acp; SOCKET sock = ac->socket->socket; grpc_endpoint **ep = ac->endpoint; @@ -215,7 +215,7 @@ failure: } else if (sock != INVALID_SOCKET) { closesocket(sock); } - grpc_exec_ctx_enqueue(exec_ctx, on_done, 0); + grpc_exec_ctx_enqueue(exec_ctx, on_done, false, NULL); } #endif /* GPR_WINSOCK_SOCKET */ diff --git a/src/core/iomgr/tcp_server_windows.c b/src/core/iomgr/tcp_server_windows.c index 00d381f2643..ce930b8f41d 100644 --- a/src/core/iomgr/tcp_server_windows.c +++ b/src/core/iomgr/tcp_server_windows.c @@ -119,7 +119,7 @@ grpc_tcp_server *grpc_tcp_server_create(grpc_closure *shutdown_complete) { static void finish_shutdown(grpc_exec_ctx *exec_ctx, grpc_tcp_server *s) { if (s->shutdown_complete != NULL) { - grpc_exec_ctx_enqueue(exec_ctx, s->shutdown_complete, 1); + grpc_exec_ctx_enqueue(exec_ctx, s->shutdown_complete, true, NULL); } /* Now that the accepts have been aborted, we can destroy the sockets. @@ -173,7 +173,7 @@ void grpc_tcp_server_unref(grpc_exec_ctx *exec_ctx, grpc_tcp_server *s) { /* Complete shutdown_starting work before destroying. */ grpc_exec_ctx local_exec_ctx = GRPC_EXEC_CTX_INIT; gpr_mu_lock(&s->mu); - grpc_exec_ctx_enqueue_list(&local_exec_ctx, &s->shutdown_starting); + grpc_exec_ctx_enqueue_list(&local_exec_ctx, &s->shutdown_starting, NULL); gpr_mu_unlock(&s->mu); if (exec_ctx == NULL) { grpc_exec_ctx_flush(&local_exec_ctx); @@ -311,7 +311,7 @@ failure: } /* Event manager callback when reads are ready. */ -static void on_accept(grpc_exec_ctx *exec_ctx, void *arg, int from_iocp) { +static void on_accept(grpc_exec_ctx *exec_ctx, void *arg, bool from_iocp) { grpc_tcp_listener *sp = arg; grpc_tcp_server_acceptor acceptor = {sp->server, sp->port_index, 0}; SOCKET sock = sp->new_socket; diff --git a/src/core/iomgr/tcp_windows.c b/src/core/iomgr/tcp_windows.c index d3f080cbf9b..038e4158c89 100644 --- a/src/core/iomgr/tcp_windows.c +++ b/src/core/iomgr/tcp_windows.c @@ -138,7 +138,7 @@ static void tcp_ref(grpc_tcp *tcp) { gpr_ref(&tcp->refcount); } #endif /* Asynchronous callback from the IOCP, or the background thread. */ -static void on_read(grpc_exec_ctx *exec_ctx, void *tcpp, int success) { +static void on_read(grpc_exec_ctx *exec_ctx, void *tcpp, bool success) { grpc_tcp *tcp = tcpp; grpc_closure *cb = tcp->read_cb; grpc_winsocket *socket = tcp->socket; @@ -184,7 +184,7 @@ static void win_read(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, WSABUF buffer; if (tcp->shutting_down) { - grpc_exec_ctx_enqueue(exec_ctx, cb, 0); + grpc_exec_ctx_enqueue(exec_ctx, cb, false, NULL); return; } @@ -208,7 +208,7 @@ static void win_read(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, /* Did we get data immediately ? Yay. */ if (info->wsa_error != WSAEWOULDBLOCK) { info->bytes_transfered = bytes_read; - grpc_exec_ctx_enqueue(exec_ctx, &tcp->on_read, 1); + grpc_exec_ctx_enqueue(exec_ctx, &tcp->on_read, true, NULL); return; } @@ -221,7 +221,7 @@ static void win_read(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, int wsa_error = WSAGetLastError(); if (wsa_error != WSA_IO_PENDING) { info->wsa_error = wsa_error; - grpc_exec_ctx_enqueue(exec_ctx, &tcp->on_read, 0); + grpc_exec_ctx_enqueue(exec_ctx, &tcp->on_read, false, NULL); return; } } @@ -230,7 +230,7 @@ static void win_read(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, } /* Asynchronous callback from the IOCP, or the background thread. */ -static void on_write(grpc_exec_ctx *exec_ctx, void *tcpp, int success) { +static void on_write(grpc_exec_ctx *exec_ctx, void *tcpp, bool success) { grpc_tcp *tcp = (grpc_tcp *)tcpp; grpc_winsocket *handle = tcp->socket; grpc_winsocket_callback_info *info = &handle->write_info; @@ -273,7 +273,7 @@ static void win_write(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, size_t len; if (tcp->shutting_down) { - grpc_exec_ctx_enqueue(exec_ctx, cb, 0); + grpc_exec_ctx_enqueue(exec_ctx, cb, false, NULL); return; } @@ -301,9 +301,9 @@ static void win_write(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, connection that has its send queue filled up. But if we don't, then we can avoid doing an async write operation at all. */ if (info->wsa_error != WSAEWOULDBLOCK) { - int ok = 0; + bool ok = false; if (status == 0) { - ok = 1; + ok = true; GPR_ASSERT(bytes_sent == tcp->write_slices->length); } else { if (socket->read_info.wsa_error != WSAECONNRESET) { @@ -313,7 +313,7 @@ static void win_write(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, } } if (allocated) gpr_free(allocated); - grpc_exec_ctx_enqueue(exec_ctx, cb, ok); + grpc_exec_ctx_enqueue(exec_ctx, cb, ok, NULL); return; } @@ -330,7 +330,7 @@ static void win_write(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, int wsa_error = WSAGetLastError(); if (wsa_error != WSA_IO_PENDING) { TCP_UNREF(tcp, "write"); - grpc_exec_ctx_enqueue(exec_ctx, cb, 0); + grpc_exec_ctx_enqueue(exec_ctx, cb, false, NULL); return; } } diff --git a/test/core/util/port_windows.c b/test/core/util/port_windows.c index 60ad9b4f2ae..70c3f02dc44 100644 --- a/test/core/util/port_windows.c +++ b/test/core/util/port_windows.c @@ -152,7 +152,7 @@ static void got_port_from_server(grpc_exec_ctx *exec_ctx, void *arg, } static void destroy_pollset_and_shutdown(grpc_exec_ctx *exec_ctx, void *p, - int success) { + bool success) { grpc_pollset_destroy(p); grpc_shutdown(); }