|
|
@ -184,7 +184,10 @@ static void on_read(grpc_exec_ctx *exec_ctx, void *tcpp, grpc_error *error) { |
|
|
|
grpc_slice_buffer_add(tcp->read_slices, sub); |
|
|
|
grpc_slice_buffer_add(tcp->read_slices, sub); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
grpc_slice_unref_internal(exec_ctx, tcp->read_slice); |
|
|
|
grpc_slice_unref_internal(exec_ctx, tcp->read_slice); |
|
|
|
error = tcp->shutting_down ? GRPC_ERROR_CREATE_REFERENCING("TCP stream shutting down", &tcp->shutdown_error, 1) : GRPC_ERROR_CREATE("End of TCP stream"); |
|
|
|
error = tcp->shutting_down |
|
|
|
|
|
|
|
? GRPC_ERROR_CREATE_REFERENCING("TCP stream shutting down", |
|
|
|
|
|
|
|
&tcp->shutdown_error, 1) |
|
|
|
|
|
|
|
: GRPC_ERROR_CREATE("End of TCP stream"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -205,8 +208,9 @@ static void win_read(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, |
|
|
|
WSABUF buffer; |
|
|
|
WSABUF buffer; |
|
|
|
|
|
|
|
|
|
|
|
if (tcp->shutting_down) { |
|
|
|
if (tcp->shutting_down) { |
|
|
|
grpc_closure_sched(exec_ctx, cb, |
|
|
|
grpc_closure_sched(exec_ctx, cb, GRPC_ERROR_CREATE_REFERENCING( |
|
|
|
GRPC_ERROR_CREATE_REFERENCING("TCP socket is shutting down", &tcp->shutdown_error, 1)); |
|
|
|
"TCP socket is shutting down", |
|
|
|
|
|
|
|
&tcp->shutdown_error, 1)); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -293,8 +297,9 @@ static void win_write(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, |
|
|
|
size_t len; |
|
|
|
size_t len; |
|
|
|
|
|
|
|
|
|
|
|
if (tcp->shutting_down) { |
|
|
|
if (tcp->shutting_down) { |
|
|
|
grpc_closure_sched(exec_ctx, cb, |
|
|
|
grpc_closure_sched(exec_ctx, cb, GRPC_ERROR_CREATE_REFERENCING( |
|
|
|
GRPC_ERROR_CREATE_REFERENCING("TCP socket is shutting down", &tcp->shutdown_error, 1)); |
|
|
|
"TCP socket is shutting down", |
|
|
|
|
|
|
|
&tcp->shutdown_error, 1)); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -375,7 +380,8 @@ static void win_add_to_pollset_set(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, |
|
|
|
we're not going to protect against these. However the IO Completion Port |
|
|
|
we're not going to protect against these. However the IO Completion Port |
|
|
|
callback will happen from another thread, so we need to protect against |
|
|
|
callback will happen from another thread, so we need to protect against |
|
|
|
concurrent access of the data structure in that regard. */ |
|
|
|
concurrent access of the data structure in that regard. */ |
|
|
|
static void win_shutdown(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, grpc_error *why) { |
|
|
|
static void win_shutdown(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, |
|
|
|
|
|
|
|
grpc_error *why) { |
|
|
|
grpc_tcp *tcp = (grpc_tcp *)ep; |
|
|
|
grpc_tcp *tcp = (grpc_tcp *)ep; |
|
|
|
gpr_mu_lock(&tcp->mu); |
|
|
|
gpr_mu_lock(&tcp->mu); |
|
|
|
/* At that point, what may happen is that we're already inside the IOCP
|
|
|
|
/* At that point, what may happen is that we're already inside the IOCP
|
|
|
@ -383,8 +389,7 @@ static void win_shutdown(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, grpc_error |
|
|
|
if (!tcp->shutting_down) { |
|
|
|
if (!tcp->shutting_down) { |
|
|
|
tcp->shutting_down = 1; |
|
|
|
tcp->shutting_down = 1; |
|
|
|
tcp->shutdown_error = why; |
|
|
|
tcp->shutdown_error = why; |
|
|
|
} |
|
|
|
} else { |
|
|
|
else { |
|
|
|
|
|
|
|
GRPC_ERROR_UNREF(why); |
|
|
|
GRPC_ERROR_UNREF(why); |
|
|
|
} |
|
|
|
} |
|
|
|
grpc_winsocket_shutdown(tcp->socket); |
|
|
|
grpc_winsocket_shutdown(tcp->socket); |
|
|
|