summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--deps/uv/ChangeLog16
-rw-r--r--deps/uv/build.mk1
-rw-r--r--deps/uv/src/unix/darwin.c10
-rw-r--r--deps/uv/src/unix/getaddrinfo.c7
-rw-r--r--deps/uv/src/version.c2
-rw-r--r--deps/uv/src/win/poll.c3
-rw-r--r--deps/uv/test/test-list.h2
-rw-r--r--deps/uv/test/test-poll-closesocket.c89
-rw-r--r--deps/uv/test/test-spawn.c4
-rw-r--r--deps/uv/uv.gyp1
10 files changed, 125 insertions, 10 deletions
diff --git a/deps/uv/ChangeLog b/deps/uv/ChangeLog
index 87c5d99b2b..a185a9f3b8 100644
--- a/deps/uv/ChangeLog
+++ b/deps/uv/ChangeLog
@@ -1,4 +1,18 @@
-2014.05.02, Version 0.10.27 (Stable)
+2014.07.32, Version 0.10.28 (Stable)
+
+Changes since version 0.10.27:
+
+* windows: fix handling closed socket while poll handle is closing (Saúl Ibarra
+ Corretgé)
+
+* unix: return system error on EAI_SYSTEM (Saúl Ibarra Corretgé)
+
+* unix: fix bogus structure field name (Saúl Ibarra Corretgé)
+
+* darwin: invoke `mach_timebase_info` only once (Fedor Indutny)
+
+
+2014.05.02, Version 0.10.27 (Stable), 6e24ce23b1e7576059f85a608eca13b766458a01
Changes since version 0.10.26:
diff --git a/deps/uv/build.mk b/deps/uv/build.mk
index e273e251bd..a2fdac7d45 100644
--- a/deps/uv/build.mk
+++ b/deps/uv/build.mk
@@ -102,6 +102,7 @@ TESTS= \
test/test-platform-output.o \
test/test-poll.o \
test/test-poll-close.o \
+ test/test-poll-closesocket.o \
test/test-process-title.o \
test/test-ref.o \
test/test-run-nowait.o \
diff --git a/deps/uv/src/unix/darwin.c b/deps/uv/src/unix/darwin.c
index 77e662f4e1..f37d58df56 100644
--- a/deps/uv/src/unix/darwin.c
+++ b/deps/uv/src/unix/darwin.c
@@ -179,12 +179,14 @@ void uv__cf_loop_signal(uv_loop_t* loop, cf_loop_signal_cb cb, void* arg) {
uint64_t uv__hrtime(void) {
- mach_timebase_info_data_t info;
+ static mach_timebase_info_data_t info;
- if (mach_timebase_info(&info) != KERN_SUCCESS)
- abort();
+ if ((ACCESS_ONCE(uint32_t, info.numer) == 0 ||
+ ACCESS_ONCE(uint32_t, info.denom) == 0) &&
+ mach_timebase_info(&info) != KERN_SUCCESS)
+ abort();
- return mach_absolute_time() * info.numer / info.denom;
+ return mach_absolute_time() * info.numer / info.denom;
}
diff --git a/deps/uv/src/unix/getaddrinfo.c b/deps/uv/src/unix/getaddrinfo.c
index 283d295f5d..287c9940e7 100644
--- a/deps/uv/src/unix/getaddrinfo.c
+++ b/deps/uv/src/unix/getaddrinfo.c
@@ -34,6 +34,8 @@ static void uv__getaddrinfo_work(struct uv__work* w) {
req->service,
req->hints,
&req->res);
+ if (req->retcode == EAI_SYSTEM)
+ req->retcode = -errno;
}
@@ -67,7 +69,10 @@ static void uv__getaddrinfo_done(struct uv__work* w, int status) {
req->service = NULL;
req->hostname = NULL;
- if (req->retcode == 0) {
+ if (req->retcode < 0) {
+ /* EAI_SYSTEM error */
+ uv__set_sys_error(req->loop, -req->retcode);
+ } else if (req->retcode == 0) {
/* OK */
#if defined(EAI_NODATA) /* FreeBSD deprecated EAI_NODATA */
} else if (req->retcode == EAI_NONAME || req->retcode == EAI_NODATA) {
diff --git a/deps/uv/src/version.c b/deps/uv/src/version.c
index 0c35b1b3cb..4267b97cca 100644
--- a/deps/uv/src/version.c
+++ b/deps/uv/src/version.c
@@ -34,7 +34,7 @@
#define UV_VERSION_MAJOR 0
#define UV_VERSION_MINOR 10
-#define UV_VERSION_PATCH 27
+#define UV_VERSION_PATCH 28
#define UV_VERSION_IS_RELEASE 1
diff --git a/deps/uv/src/win/poll.c b/deps/uv/src/win/poll.c
index f6972f9673..76427b01a4 100644
--- a/deps/uv/src/win/poll.c
+++ b/deps/uv/src/win/poll.c
@@ -187,7 +187,8 @@ static void uv__fast_poll_process_poll_req(uv_loop_t* loop, uv_poll_t* handle,
if (afd_poll_info->Handles[0].Events & AFD_POLL_LOCAL_CLOSE) {
/* Stop polling. */
handle->events = 0;
- uv__handle_stop(handle);
+ if (uv__is_active(handle))
+ uv__handle_stop(handle);
}
if (events != 0) {
diff --git a/deps/uv/test/test-list.h b/deps/uv/test/test-list.h
index c280ca95eb..7930c1c36c 100644
--- a/deps/uv/test/test-list.h
+++ b/deps/uv/test/test-list.h
@@ -215,6 +215,7 @@ TEST_DECLARE (poll_duplex)
TEST_DECLARE (poll_unidirectional)
TEST_DECLARE (poll_close)
#ifdef _WIN32
+TEST_DECLARE (poll_closesocket)
TEST_DECLARE (spawn_detect_pipe_name_collisions_on_windows)
TEST_DECLARE (argument_escaping)
TEST_DECLARE (environment_creation)
@@ -449,6 +450,7 @@ TASK_LIST_START
TEST_ENTRY (kill)
#ifdef _WIN32
+ TEST_ENTRY (poll_closesocket)
TEST_ENTRY (spawn_detect_pipe_name_collisions_on_windows)
TEST_ENTRY (argument_escaping)
TEST_ENTRY (environment_creation)
diff --git a/deps/uv/test/test-poll-closesocket.c b/deps/uv/test/test-poll-closesocket.c
new file mode 100644
index 0000000000..4db74a01f6
--- /dev/null
+++ b/deps/uv/test/test-poll-closesocket.c
@@ -0,0 +1,89 @@
+/* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#ifdef _WIN32
+
+#include <errno.h>
+
+#include "uv.h"
+#include "task.h"
+
+uv_os_sock_t sock;
+uv_poll_t handle;
+
+static int close_cb_called = 0;
+
+
+static void close_cb(uv_handle_t* h) {
+ close_cb_called++;
+}
+
+
+static void poll_cb(uv_poll_t* h, int status, int events) {
+ int r;
+
+ ASSERT(status == 0);
+ ASSERT(h == &handle);
+
+ r = uv_poll_start(&handle, UV_READABLE, poll_cb);
+ ASSERT(r == 0);
+
+ closesocket(sock);
+ uv_close((uv_handle_t*) &handle, close_cb);
+
+}
+
+
+TEST_IMPL(poll_closesocket) {
+ struct WSAData wsa_data;
+ int r;
+ unsigned long on;
+ struct sockaddr_in addr;
+
+ r = WSAStartup(MAKEWORD(2, 2), &wsa_data);
+ ASSERT(r == 0);
+
+ sock = socket(AF_INET, SOCK_STREAM, 0);
+ ASSERT(sock != INVALID_SOCKET);
+ on = 1;
+ r = ioctlsocket(sock, FIONBIO, &on);
+ ASSERT(r == 0);
+
+ r = uv_ip4_addr("127.0.0.1", TEST_PORT, &addr);
+ ASSERT(r == 0);
+
+ r = connect(sock, (const struct sockaddr*) &addr, sizeof addr);
+ ASSERT(r != 0);
+ ASSERT(WSAGetLastError() == WSAEWOULDBLOCK);
+
+ r = uv_poll_init_socket(uv_default_loop(), &handle, sock);
+ ASSERT(r == 0);
+ r = uv_poll_start(&handle, UV_WRITABLE, poll_cb);
+ ASSERT(r == 0);
+
+ uv_run(uv_default_loop(), UV_RUN_DEFAULT);
+
+ ASSERT(close_cb_called == 1);
+
+ MAKE_VALGRIND_HAPPY();
+ return 0;
+}
+#endif
diff --git a/deps/uv/test/test-spawn.c b/deps/uv/test/test-spawn.c
index 3afe0cbcbe..43da6664ba 100644
--- a/deps/uv/test/test-spawn.c
+++ b/deps/uv/test/test-spawn.c
@@ -681,9 +681,9 @@ TEST_IMPL(spawn_closed_process_io) {
uv_write_t write_req;
uv_buf_t buf;
uv_stdio_container_t stdio[2];
- static char buffer[] = "hello-from-spawn_stdin";
+ static char buffer[] = "hello-from-spawn_stdin\n";
- init_process_options("spawn_helper1", exit_cb);
+ init_process_options("spawn_helper3", exit_cb);
uv_pipe_init(uv_default_loop(), &in, 0);
options.stdio = stdio;
diff --git a/deps/uv/uv.gyp b/deps/uv/uv.gyp
index 4e87dc1a38..7cd0f7d45a 100644
--- a/deps/uv/uv.gyp
+++ b/deps/uv/uv.gyp
@@ -322,6 +322,7 @@
'test/test-platform-output.c',
'test/test-poll.c',
'test/test-poll-close.c',
+ 'test/test-poll-closesocket.c',
'test/test-process-title.c',
'test/test-ref.c',
'test/test-run-nowait.c',