summaryrefslogtreecommitdiff
path: root/Utilities/cmlibuv/src/win/stream.c
diff options
context:
space:
mode:
Diffstat (limited to 'Utilities/cmlibuv/src/win/stream.c')
-rw-r--r--Utilities/cmlibuv/src/win/stream.c31
1 files changed, 19 insertions, 12 deletions
diff --git a/Utilities/cmlibuv/src/win/stream.c b/Utilities/cmlibuv/src/win/stream.c
index abf477f644..292bf588da 100644
--- a/Utilities/cmlibuv/src/win/stream.c
+++ b/Utilities/cmlibuv/src/win/stream.c
@@ -29,14 +29,16 @@
int uv_listen(uv_stream_t* stream, int backlog, uv_connection_cb cb) {
int err;
-
+ if (uv__is_closing(stream)) {
+ return UV_EINVAL;
+ }
err = ERROR_INVALID_PARAMETER;
switch (stream->type) {
case UV_TCP:
- err = uv_tcp_listen((uv_tcp_t*)stream, backlog, cb);
+ err = uv__tcp_listen((uv_tcp_t*)stream, backlog, cb);
break;
case UV_NAMED_PIPE:
- err = uv_pipe_listen((uv_pipe_t*)stream, backlog, cb);
+ err = uv__pipe_listen((uv_pipe_t*)stream, backlog, cb);
break;
default:
assert(0);
@@ -52,10 +54,10 @@ int uv_accept(uv_stream_t* server, uv_stream_t* client) {
err = ERROR_INVALID_PARAMETER;
switch (server->type) {
case UV_TCP:
- err = uv_tcp_accept((uv_tcp_t*)server, (uv_tcp_t*)client);
+ err = uv__tcp_accept((uv_tcp_t*)server, (uv_tcp_t*)client);
break;
case UV_NAMED_PIPE:
- err = uv_pipe_accept((uv_pipe_t*)server, client);
+ err = uv__pipe_accept((uv_pipe_t*)server, client);
break;
default:
assert(0);
@@ -73,13 +75,13 @@ int uv__read_start(uv_stream_t* handle,
err = ERROR_INVALID_PARAMETER;
switch (handle->type) {
case UV_TCP:
- err = uv_tcp_read_start((uv_tcp_t*)handle, alloc_cb, read_cb);
+ err = uv__tcp_read_start((uv_tcp_t*)handle, alloc_cb, read_cb);
break;
case UV_NAMED_PIPE:
- err = uv_pipe_read_start((uv_pipe_t*)handle, alloc_cb, read_cb);
+ err = uv__pipe_read_start((uv_pipe_t*)handle, alloc_cb, read_cb);
break;
case UV_TTY:
- err = uv_tty_read_start((uv_tty_t*) handle, alloc_cb, read_cb);
+ err = uv__tty_read_start((uv_tty_t*) handle, alloc_cb, read_cb);
break;
default:
assert(0);
@@ -97,7 +99,7 @@ int uv_read_stop(uv_stream_t* handle) {
err = 0;
if (handle->type == UV_TTY) {
- err = uv_tty_read_stop((uv_tty_t*) handle);
+ err = uv__tty_read_stop((uv_tty_t*) handle);
} else if (handle->type == UV_NAMED_PIPE) {
uv__pipe_read_stop((uv_pipe_t*) handle);
} else {
@@ -124,14 +126,14 @@ int uv_write(uv_write_t* req,
err = ERROR_INVALID_PARAMETER;
switch (handle->type) {
case UV_TCP:
- err = uv_tcp_write(loop, req, (uv_tcp_t*) handle, bufs, nbufs, cb);
+ err = uv__tcp_write(loop, req, (uv_tcp_t*) handle, bufs, nbufs, cb);
break;
case UV_NAMED_PIPE:
err = uv__pipe_write(
loop, req, (uv_pipe_t*) handle, bufs, nbufs, NULL, cb);
break;
case UV_TTY:
- err = uv_tty_write(loop, req, (uv_tty_t*) handle, bufs, nbufs, cb);
+ err = uv__tty_write(loop, req, (uv_tty_t*) handle, bufs, nbufs, cb);
break;
default:
assert(0);
@@ -217,7 +219,12 @@ int uv_shutdown(uv_shutdown_t* req, uv_stream_t* handle, uv_shutdown_cb cb) {
handle->reqs_pending++;
REGISTER_HANDLE_REQ(loop, handle, req);
- uv_want_endgame(loop, (uv_handle_t*)handle);
+ if (handle->stream.conn.write_reqs_pending == 0) {
+ if (handle->type == UV_NAMED_PIPE)
+ uv__pipe_shutdown(loop, (uv_pipe_t*) handle, req);
+ else
+ uv__insert_pending_req(loop, (uv_req_t*) req);
+ }
return 0;
}