We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ebd89aa commit 917c4e2Copy full SHA for 917c4e2
src/libuv/dist-files
@@ -264,6 +264,7 @@
264
./test/test-getsockname.c
265
./test/test-hrtime.c
266
./test/test-idle.c
267
+./test/test-ipc-send-recv.c
268
./test/test-ipc.c
269
./test/test-list.h
270
./test/test-loop-handles.c
@@ -277,6 +278,7 @@
277
278
./test/test-process-title.c
279
./test/test-ref.c
280
./test/test-run-once.c
281
+./test/test-shutdown-close.c
282
./test/test-shutdown-eof.c
283
./test/test-spawn.c
284
./test/test-stdio-over-pipes.c
src/libuv/include/uv.h
@@ -80,7 +80,7 @@ typedef intptr_t ssize_t;
80
XX( 7, EAFNOSUPPORT, "") \
81
XX( 8, EALREADY, "") \
82
XX( 9, EBADF, "bad file descriptor") \
83
- XX( 10, EBUSY, "mount device busy") \
+ XX( 10, EBUSY, "resource busy or locked") \
84
XX( 11, ECONNABORTED, "software caused connection abort") \
85
XX( 12, ECONNREFUSED, "connection refused") \
86
XX( 13, ECONNRESET, "connection reset by peer") \
@@ -120,7 +120,8 @@ typedef intptr_t ssize_t;
120
XX( 49, ENAMETOOLONG, "name too long") \
121
XX( 50, EPERM, "operation not permitted") \
122
XX( 51, ELOOP, "too many symbolic links encountered") \
123
- XX( 52, EXDEV, "cross-device link not permitted")
+ XX( 52, EXDEV, "cross-device link not permitted") \
124
+ XX( 53, ENOTEMPTY, "directory not empty")
125
126
127
#define UV_ERRNO_GEN(val, name, s) UV_##name = val,
src/libuv/src/unix/error.c
@@ -88,6 +88,8 @@ uv_err_code uv_translate_sys_error(int sys_errno) {
88
case ESRCH: return UV_ESRCH;
89
case ETIMEDOUT: return UV_ETIMEDOUT;
90
case EXDEV: return UV_EXDEV;
91
+ case EBUSY: return UV_EBUSY;
92
+ case ENOTEMPTY: return UV_ENOTEMPTY;
93
default: return UV_UNKNOWN;
94
}
95
UNREACHABLE();
src/libuv/src/unix/stream.c
@@ -22,14 +22,17 @@
22
#include "uv.h"
23
#include "internal.h"
24
25
-#include <assert.h>
26
-#include <errno.h>
27
-#include <unistd.h>
+#include <stdio.h>
28
#include <stdlib.h>
29
#include <string.h>
30
-#include <sys/uio.h>
+#include <assert.h>
+#include <errno.h>
31
32
-#include <stdio.h>
+#include <sys/types.h>
+#include <sys/socket.h>
33
+#include <sys/uio.h>
34
+#include <sys/un.h>
35
+#include <unistd.h>
36
37
38
static void uv__stream_connect(uv_stream_t*);
@@ -513,6 +516,28 @@ static void uv__write_callbacks(uv_stream_t* stream) {
513
516
514
517
515
518
519
+static uv_handle_type uv__handle_type(int fd) {
520
+ struct sockaddr_storage ss;
521
+ socklen_t len;
522
+
523
+ memset(&ss, 0, sizeof(ss));
524
+ len = sizeof(ss);
525
526
+ if (getsockname(fd, (struct sockaddr*)&ss, &len))
527
+ return UV_UNKNOWN_HANDLE;
528
529
+ switch (ss.ss_family) {
530
+ case AF_UNIX:
531
+ return UV_NAMED_PIPE;
532
+ case AF_INET:
533
+ case AF_INET6:
534
+ return UV_TCP;
535
+ }
536
537
538
+}
539
540
541
static void uv__read(uv_stream_t* stream) {
542
uv_buf_t buf;
543
ssize_t nread;
@@ -633,7 +658,8 @@ static void uv__read(uv_stream_t* stream) {
633
658
634
659
635
660
if (stream->accepted_fd >= 0) {
636
- stream->read2_cb((uv_pipe_t*)stream, nread, buf, UV_TCP);
661
+ stream->read2_cb((uv_pipe_t*)stream, nread, buf,
662
+ uv__handle_type(stream->accepted_fd));
637
663
} else {
638
664
stream->read2_cb((uv_pipe_t*)stream, nread, buf, UV_UNKNOWN_HANDLE);
639
665
src/libuv/src/win/error.c
@@ -78,6 +78,8 @@ uv_err_code uv_translate_sys_error(int sys_errno) {
78
case WSAEAFNOSUPPORT: return UV_EAFNOSUPPORT;
79
case WSAEWOULDBLOCK: return UV_EAGAIN;
case WSAEALREADY: return UV_EALREADY;
+ case ERROR_LOCK_VIOLATION: return UV_EBUSY;
+ case ERROR_SHARING_VIOLATION: return UV_EBUSY;
case ERROR_CONNECTION_ABORTED: return UV_ECONNABORTED;
case WSAECONNABORTED: return UV_ECONNABORTED;
case ERROR_CONNECTION_REFUSED: return UV_ECONNREFUSED;
@@ -89,6 +91,8 @@ uv_err_code uv_translate_sys_error(int sys_errno) {
case WSAEFAULT: return UV_EFAULT;
case ERROR_HOST_UNREACHABLE: return UV_EHOSTUNREACH;
case WSAEHOSTUNREACH: return UV_EHOSTUNREACH;
+ case ERROR_OPERATION_ABORTED: return UV_EINTR;
+ case WSAEINTR: return UV_EINTR;
96
case ERROR_INVALID_DATA: return UV_EINVAL;
97
case WSAEINVAL: return UV_EINVAL;
98
case ERROR_CANT_RESOLVE_FILENAME: return UV_ELOOP;
@@ -102,6 +106,7 @@ uv_err_code uv_translate_sys_error(int sys_errno) {
102
106
case ERROR_OUTOFMEMORY: return UV_ENOMEM;
103
107
case ERROR_NOT_CONNECTED: return UV_ENOTCONN;
104
108
case WSAENOTCONN: return UV_ENOTCONN;
109
+ case ERROR_DIR_NOT_EMPTY: return UV_ENOTEMPTY;
105
110
case ERROR_NOT_SUPPORTED: return UV_ENOTSUP;
111
case ERROR_INSUFFICIENT_BUFFER: return UV_EINVAL;
112
case ERROR_INVALID_FLAGS: return UV_EBADF;
src/libuv/src/win/fs.c
@@ -541,7 +541,8 @@ static void fs__stat(uv_fs_t* req, const wchar_t* path) {
req->stat.st_size = ((int64_t) info.nFileSizeHigh << 32) +
(int64_t) info.nFileSizeLow;
544
- req->stat.st_nlink = info.nNumberOfLinks;
+ req->stat.st_nlink = (info.nNumberOfLinks <= SHRT_MAX) ?
545
+ (short) info.nNumberOfLinks : SHRT_MAX;
546
547
req->ptr = &req->stat;
548
req->result = 0;
src/libuv/src/win/handle.c
@@ -27,9 +27,15 @@
uv_handle_type uv_guess_handle(uv_file file) {
- HANDLE handle = (HANDLE) _get_osfhandle(file);
+ HANDLE handle;
DWORD mode;
+ if (file < 0) {
+ handle = (HANDLE) _get_osfhandle(file);
39
switch (GetFileType(handle)) {
40
case FILE_TYPE_CHAR:
41
if (GetConsoleMode(handle, &mode)) {
@@ -85,9 +91,10 @@ void uv_close(uv_handle_t* handle, uv_close_cb cb) {
tcp = (uv_tcp_t*)handle;
/* If we don't shutdown before calling closesocket, windows will */
87
/* silently discard the kernel send buffer and reset the connection. */
- if (!(tcp->flags & UV_HANDLE_SHUT)) {
+ if ((tcp->flags & UV_HANDLE_CONNECTION) &&
+ !(tcp->flags & UV_HANDLE_SHUT)) {
shutdown(tcp->socket, SD_SEND);
- tcp->flags |= UV_HANDLE_SHUT;
+ tcp->flags |= UV_HANDLE_SHUTTING | UV_HANDLE_SHUT;
99
tcp->flags &= ~(UV_HANDLE_READING | UV_HANDLE_LISTENING);
100
closesocket(tcp->socket);
@@ -173,7 +180,7 @@ void uv_want_endgame(uv_loop_t* loop, uv_handle_t* handle) {
173
180
void uv_process_endgames(uv_loop_t* loop) {
174
181
uv_handle_t* handle;
175
182
176
- while (loop->endgame_handles) {
183
+ while (loop->endgame_handles && loop->refs > 0) {
177
184
handle = loop->endgame_handles;
178
185
loop->endgame_handles = handle->endgame_next;
179
186
0 commit comments