|
|
|
@ -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; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|