Windows changes

reviewable/pr20892/r1
Yash Tibrewal 5 years ago
parent 3dd6292f5d
commit cd2c3cdfaa
  1. 4
      src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc
  2. 5
      src/core/lib/iomgr/pollset_windows.cc
  3. 2
      src/core/lib/iomgr/resolve_address_windows.cc
  4. 4
      src/core/lib/iomgr/socket_windows.cc
  5. 4
      src/core/lib/iomgr/tcp_client_windows.cc
  6. 5
      src/core/lib/iomgr/tcp_server_windows.cc
  7. 29
      src/core/lib/iomgr/tcp_windows.cc

@ -128,12 +128,12 @@ class GrpcPolledFdWindows {
} }
void ScheduleAndNullReadClosure(grpc_error* error) { void ScheduleAndNullReadClosure(grpc_error* error) {
ExecCtx::Run(DEBUG_LOCATION, read_closure_, error); grpc_core::ExecCtx::Run(DEBUG_LOCATION, read_closure_, error);
read_closure_ = nullptr; read_closure_ = nullptr;
} }
void ScheduleAndNullWriteClosure(grpc_error* error) { void ScheduleAndNullWriteClosure(grpc_error* error) {
ExecCtx::Run(DEBUG_LOCATION, write_closure_, error); grpc_core::ExecCtx::Run(DEBUG_LOCATION, write_closure_, error);
write_closure_ = nullptr; write_closure_ = nullptr;
} }

@ -98,7 +98,7 @@ static void pollset_shutdown(grpc_pollset* pollset, grpc_closure* closure) {
pollset->shutting_down = 1; pollset->shutting_down = 1;
grpc_pollset_kick(pollset, GRPC_POLLSET_KICK_BROADCAST); grpc_pollset_kick(pollset, GRPC_POLLSET_KICK_BROADCAST);
if (!pollset->is_iocp_worker) { if (!pollset->is_iocp_worker) {
ExecCtx::Run(DEBUG_LOCATION, closure, GRPC_ERROR_NONE); grpc_core::ExecCtx::Run(DEBUG_LOCATION, closure, GRPC_ERROR_NONE);
} else { } else {
pollset->on_shutdown = closure; pollset->on_shutdown = closure;
} }
@ -146,7 +146,8 @@ static grpc_error* pollset_work(grpc_pollset* pollset,
} }
if (pollset->shutting_down && pollset->on_shutdown != NULL) { if (pollset->shutting_down && pollset->on_shutdown != NULL) {
ExecCtx::Run(DEBUG_LOCATION, pollset->on_shutdown, GRPC_ERROR_NONE); grpc_core::ExecCtx::Run(DEBUG_LOCATION, pollset->on_shutdown,
GRPC_ERROR_NONE);
pollset->on_shutdown = NULL; pollset->on_shutdown = NULL;
} }
goto done; goto done;

@ -138,7 +138,7 @@ static void do_request_thread(void* rp, grpc_error* error) {
} else { } else {
GRPC_ERROR_REF(error); GRPC_ERROR_REF(error);
} }
ExecCtx::Run(DEBUG_LOCATION, r->on_done, error); grpc_core::ExecCtx::Run(DEBUG_LOCATION, r->on_done, error);
gpr_free(r->name); gpr_free(r->name);
gpr_free(r->default_port); gpr_free(r->default_port);
gpr_free(r); gpr_free(r);

@ -124,7 +124,7 @@ static void socket_notify_on_iocp(grpc_winsocket* socket, grpc_closure* closure,
gpr_mu_lock(&socket->state_mu); gpr_mu_lock(&socket->state_mu);
if (info->has_pending_iocp) { if (info->has_pending_iocp) {
info->has_pending_iocp = 0; info->has_pending_iocp = 0;
ExecCtx::Run(DEBUG_LOCATION, closure, GRPC_ERROR_NONE); grpc_core::ExecCtx::Run(DEBUG_LOCATION, closure, GRPC_ERROR_NONE);
} else { } else {
info->closure = closure; info->closure = closure;
} }
@ -145,7 +145,7 @@ void grpc_socket_become_ready(grpc_winsocket* socket,
GPR_ASSERT(!info->has_pending_iocp); GPR_ASSERT(!info->has_pending_iocp);
gpr_mu_lock(&socket->state_mu); gpr_mu_lock(&socket->state_mu);
if (info->closure) { if (info->closure) {
ExecCtx::Run(DEBUG_LOCATION, info->closure, GRPC_ERROR_NONE); grpc_core::ExecCtx::Run(DEBUG_LOCATION, info->closure, GRPC_ERROR_NONE);
info->closure = NULL; info->closure = NULL;
} else { } else {
info->has_pending_iocp = 1; info->has_pending_iocp = 1;

@ -117,7 +117,7 @@ static void on_connect(void* acp, grpc_error* error) {
async_connect_unlock_and_cleanup(ac, socket); async_connect_unlock_and_cleanup(ac, socket);
/* If the connection was aborted, the callback was already called when /* If the connection was aborted, the callback was already called when
the deadline was met. */ the deadline was met. */
ExecCtx::Run(DEBUG_LOCATION, on_done, error); grpc_core::ExecCtx::Run(DEBUG_LOCATION, on_done, error);
} }
/* Tries to issue one async connection, then schedules both an IOCP /* Tries to issue one async connection, then schedules both an IOCP
@ -225,7 +225,7 @@ failure:
} else if (sock != INVALID_SOCKET) { } else if (sock != INVALID_SOCKET) {
closesocket(sock); closesocket(sock);
} }
ExecCtx::Run(DEBUG_LOCATION, on_done, final_error); grpc_core::ExecCtx::Run(DEBUG_LOCATION, on_done, final_error);
} }
grpc_tcp_client_vtable grpc_windows_tcp_client_vtable = {tcp_connect}; grpc_tcp_client_vtable grpc_windows_tcp_client_vtable = {tcp_connect};

@ -135,10 +135,11 @@ static void destroy_server(void* arg, grpc_error* error) {
static void finish_shutdown_locked(grpc_tcp_server* s) { static void finish_shutdown_locked(grpc_tcp_server* s) {
if (s->shutdown_complete != NULL) { if (s->shutdown_complete != NULL) {
ExecCtx::Run(DEBUG_LOCATION, s->shutdown_complete, GRPC_ERROR_NONE); grpc_core::ExecCtx::Run(DEBUG_LOCATION, s->shutdown_complete,
GRPC_ERROR_NONE);
} }
ExecCtx::Run( grpc_core::ExecCtx::Run(
DEBUG_LOCATION, DEBUG_LOCATION,
GRPC_CLOSURE_CREATE(destroy_server, s, grpc_schedule_on_exec_ctx), GRPC_CLOSURE_CREATE(destroy_server, s, grpc_schedule_on_exec_ctx),
GRPC_ERROR_NONE); GRPC_ERROR_NONE);

@ -233,7 +233,7 @@ static void on_read(void* tcpp, grpc_error* error) {
tcp->read_cb = NULL; tcp->read_cb = NULL;
TCP_UNREF(tcp, "read"); TCP_UNREF(tcp, "read");
ExecCtx::Run(DEBUG_LOCATION, cb, error); grpc_core::ExecCtx::Run(DEBUG_LOCATION, cb, error);
} }
#define DEFAULT_TARGET_READ_SIZE 8192 #define DEFAULT_TARGET_READ_SIZE 8192
@ -254,9 +254,10 @@ static void win_read(grpc_endpoint* ep, grpc_slice_buffer* read_slices,
} }
if (tcp->shutting_down) { if (tcp->shutting_down) {
ExecCtx::Run(DEBUG_LOCATION, cb, grpc_core::ExecCtx::Run(
GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING( DEBUG_LOCATION, cb,
"TCP socket is shutting down", &tcp->shutdown_error, 1)); GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
"TCP socket is shutting down", &tcp->shutdown_error, 1));
return; return;
} }
@ -289,7 +290,7 @@ static void win_read(grpc_endpoint* ep, grpc_slice_buffer* read_slices,
/* Did we get data immediately ? Yay. */ /* Did we get data immediately ? Yay. */
if (info->wsa_error != WSAEWOULDBLOCK) { if (info->wsa_error != WSAEWOULDBLOCK) {
info->bytes_transferred = bytes_read; info->bytes_transferred = bytes_read;
ExecCtx::Run(DEBUG_LOCATION, &tcp->on_read, GRPC_ERROR_NONE); grpc_core::ExecCtx::Run(DEBUG_LOCATION, &tcp->on_read, GRPC_ERROR_NONE);
return; return;
} }
@ -302,8 +303,8 @@ static void win_read(grpc_endpoint* ep, grpc_slice_buffer* read_slices,
int wsa_error = WSAGetLastError(); int wsa_error = WSAGetLastError();
if (wsa_error != WSA_IO_PENDING) { if (wsa_error != WSA_IO_PENDING) {
info->wsa_error = wsa_error; info->wsa_error = wsa_error;
ExecCtx::Run(DEBUG_LOCATION, &tcp->on_read, grpc_core::ExecCtx::Run(DEBUG_LOCATION, &tcp->on_read,
GRPC_WSA_ERROR(info->wsa_error, "WSARecv")); GRPC_WSA_ERROR(info->wsa_error, "WSARecv"));
return; return;
} }
} }
@ -338,7 +339,7 @@ static void on_write(void* tcpp, grpc_error* error) {
} }
TCP_UNREF(tcp, "write"); TCP_UNREF(tcp, "write");
ExecCtx::Run(DEBUG_LOCATION, cb, error); grpc_core::ExecCtx::Run(DEBUG_LOCATION, cb, error);
} }
/* Initiates a write. */ /* Initiates a write. */
@ -366,9 +367,10 @@ static void win_write(grpc_endpoint* ep, grpc_slice_buffer* slices,
} }
if (tcp->shutting_down) { if (tcp->shutting_down) {
ExecCtx::Run(DEBUG_LOCATION, cb, grpc_core::ExecCtx::Run(
GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING( DEBUG_LOCATION, cb,
"TCP socket is shutting down", &tcp->shutdown_error, 1)); GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
"TCP socket is shutting down", &tcp->shutdown_error, 1));
return; return;
} }
@ -399,7 +401,7 @@ static void win_write(grpc_endpoint* ep, grpc_slice_buffer* slices,
grpc_error* error = status == 0 grpc_error* error = status == 0
? GRPC_ERROR_NONE ? GRPC_ERROR_NONE
: GRPC_WSA_ERROR(info->wsa_error, "WSASend"); : GRPC_WSA_ERROR(info->wsa_error, "WSASend");
ExecCtx::Run(DEBUG_LOCATION, cb, error); grpc_core::ExecCtx::Run(DEBUG_LOCATION, cb, error);
if (allocated) gpr_free(allocated); if (allocated) gpr_free(allocated);
return; return;
} }
@ -417,7 +419,8 @@ static void win_write(grpc_endpoint* ep, grpc_slice_buffer* slices,
int wsa_error = WSAGetLastError(); int wsa_error = WSAGetLastError();
if (wsa_error != WSA_IO_PENDING) { if (wsa_error != WSA_IO_PENDING) {
TCP_UNREF(tcp, "write"); TCP_UNREF(tcp, "write");
ExecCtx::Run(DEBUG_LOCATION, cb, GRPC_WSA_ERROR(wsa_error, "WSASend")); grpc_core::ExecCtx::Run(DEBUG_LOCATION, cb,
GRPC_WSA_ERROR(wsa_error, "WSASend"));
return; return;
} }
} }

Loading…
Cancel
Save