diff options
author | Timothy J Fontaine <tjfontaine@gmail.com> | 2014-02-18 13:04:29 -0800 |
---|---|---|
committer | Timothy J Fontaine <tjfontaine@gmail.com> | 2014-02-18 13:04:29 -0800 |
commit | c2aea3747dafaa979c9d21cc7acead32324bfb3a (patch) | |
tree | 0f149cdc4968060ec9135976f58f927d97225934 | |
parent | abbde2fafab5d722e156aa6fadd343e671446ace (diff) | |
download | node-c2aea3747dafaa979c9d21cc7acead32324bfb3a.tar.gz |
uv: Upgrade to v0.10.25
-rw-r--r-- | deps/uv/AUTHORS | 3 | ||||
-rw-r--r-- | deps/uv/ChangeLog | 24 | ||||
-rw-r--r-- | deps/uv/build.mk | 1 | ||||
-rw-r--r-- | deps/uv/src/unix/linux-core.c | 4 | ||||
-rw-r--r-- | deps/uv/src/unix/stream.c | 12 | ||||
-rw-r--r-- | deps/uv/src/unix/sunos.c | 19 | ||||
-rw-r--r-- | deps/uv/src/version.c | 2 | ||||
-rw-r--r-- | deps/uv/src/win/tcp.c | 3 | ||||
-rw-r--r-- | deps/uv/test/test-list.h | 4 | ||||
-rw-r--r-- | deps/uv/test/test-shutdown-twice.c | 83 | ||||
-rw-r--r-- | deps/uv/uv.gyp | 1 |
11 files changed, 143 insertions, 13 deletions
diff --git a/deps/uv/AUTHORS b/deps/uv/AUTHORS index bf8f7ee7c..dcb993181 100644 --- a/deps/uv/AUTHORS +++ b/deps/uv/AUTHORS @@ -91,3 +91,6 @@ Alex Gaynor <alex.gaynor@gmail.com> huxingyi <huxingyi@msn.com> Alex Crichton <alex@alexcrichton.com> Luca Bruno <lucab@debian.org> +Trevor Norris <trev.norris@gmail.com> +Oguz Bastemur <obastemur@gmail.com> +Alexis Campailla <alexis@janeasystems.com> diff --git a/deps/uv/ChangeLog b/deps/uv/ChangeLog index 13c4efcb4..b41636dd5 100644 --- a/deps/uv/ChangeLog +++ b/deps/uv/ChangeLog @@ -1,4 +1,26 @@ -2014.01.23, Version 0.10.23 (Stable) +2014.02.19, Version 0.10.25 (Stable) + +Changes since version 0.10.24: + +* stream: start thread after assignments (Oguz Bastemur) + +* unix: correct error when calling uv_shutdown twice (Saúl Ibarra Corretgé) + +* windows: freeze in uv_tcp_endgame (Alexis Campailla) + +* sunos: handle rearm errors (Fedor Indutny) + + +2014.01.30, Version 0.10.24 (Stable), aecd296b6bce9b40f06a61c5c94e43d45ac7308a + +Changes since version 0.10.23: + +* linux: move sscanf() out of the assert() (Trevor Norris) + +* linux: fix C99/C++ comment (Fedor Indutny) + + +2014.01.23, Version 0.10.23 (Stable), dbd218e699fec8be311d85e4788be9e28ae884f8 Changes since version 0.10.22: diff --git a/deps/uv/build.mk b/deps/uv/build.mk index 5077929d6..e273e251b 100644 --- a/deps/uv/build.mk +++ b/deps/uv/build.mk @@ -109,6 +109,7 @@ TESTS= \ test/test-semaphore.o \ test/test-shutdown-close.o \ test/test-shutdown-eof.o \ + test/test-shutdown-twice.o \ test/test-signal.o \ test/test-signal-multiple-loops.o \ test/test-spawn.o \ diff --git a/deps/uv/src/unix/linux-core.c b/deps/uv/src/unix/linux-core.c index 74294eb2c..7a8fcd354 100644 --- a/deps/uv/src/unix/linux-core.c +++ b/deps/uv/src/unix/linux-core.c @@ -602,7 +602,9 @@ static int read_times(unsigned int numcpus, uv_cpu_info_t* ci) { /* skip "cpu<num> " marker */ { unsigned int n; - assert(sscanf(buf, "cpu%u ", &n) == 1); + int r = sscanf(buf, "cpu%u ", &n); + assert(r == 1); + (void) r; /* silence build warning */ for (len = sizeof("cpu0"); n /= 10; len++); } diff --git a/deps/uv/src/unix/stream.c b/deps/uv/src/unix/stream.c index 0bc5fe853..98e41a308 100644 --- a/deps/uv/src/unix/stream.c +++ b/deps/uv/src/unix/stream.c @@ -282,6 +282,7 @@ int uv__stream_try_select(uv_stream_t* stream, int* fd) { int fds[2]; int ret; int kq; + int old_fd; kq = kqueue(); if (kq == -1) { @@ -333,16 +334,20 @@ int uv__stream_try_select(uv_stream_t* stream, int* fd) { s->fake_fd = fds[0]; s->int_fd = fds[1]; - if (uv_thread_create(&s->thread, uv__stream_osx_select, stream)) - goto fatal4; - + old_fd = *fd; s->stream = stream; stream->select = s; *fd = s->fake_fd; + if (uv_thread_create(&s->thread, uv__stream_osx_select, stream)) + goto fatal4; + return 0; fatal4: + s->stream = NULL; + stream->select = NULL; + *fd = old_fd; close(s->fake_fd); close(s->int_fd); s->fake_fd = -1; @@ -1075,6 +1080,7 @@ int uv_shutdown(uv_shutdown_t* req, uv_stream_t* stream, uv_shutdown_cb cb) { if (!(stream->flags & UV_STREAM_WRITABLE) || stream->flags & UV_STREAM_SHUT || + stream->flags & UV_STREAM_SHUTTING || stream->flags & UV_CLOSED || stream->flags & UV_CLOSING) { uv__set_artificial_error(stream->loop, UV_ENOTCONN); diff --git a/deps/uv/src/unix/sunos.c b/deps/uv/src/unix/sunos.c index e2a72dbc5..9030bfa6b 100644 --- a/deps/uv/src/unix/sunos.c +++ b/deps/uv/src/unix/sunos.c @@ -303,9 +303,9 @@ void uv_loadavg(double avg[3]) { #if defined(PORT_SOURCE_FILE) -static void uv__fs_event_rearm(uv_fs_event_t *handle) { +static int uv__fs_event_rearm(uv_fs_event_t* handle) { if (handle->fd == -1) - return; + return 0; if (port_associate(handle->loop->fs_fd, PORT_SOURCE_FILE, @@ -313,8 +313,10 @@ static void uv__fs_event_rearm(uv_fs_event_t *handle) { FILE_ATTRIB | FILE_MODIFIED, handle) == -1) { uv__set_sys_error(handle->loop, errno); + return -1; } handle->fd = PORT_LOADED; + return 0; } @@ -361,11 +363,12 @@ static void uv__fs_event_read(uv_loop_t* loop, assert(events != 0); handle->fd = PORT_FIRED; handle->cb(handle, NULL, events, 0); + + if (handle->fd != PORT_DELETED) + if (uv__fs_event_rearm(handle) != 0) + handle->cb(handle, NULL, 0, -1); } while (handle->fd != PORT_DELETED); - - if (handle != NULL && handle->fd != PORT_DELETED) - uv__fs_event_rearm(handle); } @@ -387,14 +390,16 @@ int uv_fs_event_init(uv_loop_t* loop, } uv__handle_init(loop, (uv_handle_t*)handle, UV_FS_EVENT); - uv__handle_start(handle); /* FIXME shouldn't start automatically */ handle->filename = strdup(filename); handle->fd = PORT_UNUSED; handle->cb = cb; memset(&handle->fo, 0, sizeof handle->fo); handle->fo.fo_name = handle->filename; - uv__fs_event_rearm(handle); + if (uv__fs_event_rearm(handle) != 0) + return -1; + + uv__handle_start(handle); /* FIXME shouldn't start automatically */ if (first_run) { uv__io_init(&loop->fs_event_watcher, uv__fs_event_read, portfd); diff --git a/deps/uv/src/version.c b/deps/uv/src/version.c index 028ff2537..8ea385ed5 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 23 +#define UV_VERSION_PATCH 25 #define UV_VERSION_IS_RELEASE 1 diff --git a/deps/uv/src/win/tcp.c b/deps/uv/src/win/tcp.c index 59a36de01..a91c57848 100644 --- a/deps/uv/src/win/tcp.c +++ b/deps/uv/src/win/tcp.c @@ -577,6 +577,7 @@ int uv_tcp_listen(uv_tcp_t* handle, int backlog, uv_connection_cb cb) { req->accept_socket = INVALID_SOCKET; req->data = handle; req->wait_handle = INVALID_HANDLE_VALUE; + req->event_handle = NULL; } } @@ -1040,9 +1041,11 @@ void uv_process_tcp_write_req(uv_loop_t* loop, uv_tcp_t* handle, if (handle->flags & UV_HANDLE_EMULATE_IOCP) { if (req->wait_handle != INVALID_HANDLE_VALUE) { UnregisterWait(req->wait_handle); + req->wait_handle = INVALID_HANDLE_VALUE; } if (req->event_handle) { CloseHandle(req->event_handle); + req->event_handle = NULL; } } diff --git a/deps/uv/test/test-list.h b/deps/uv/test/test-list.h index 06c56fca9..f60eab30b 100644 --- a/deps/uv/test/test-list.h +++ b/deps/uv/test/test-list.h @@ -94,6 +94,7 @@ TEST_DECLARE (connection_fail_doesnt_auto_close) TEST_DECLARE (shutdown_close_tcp) TEST_DECLARE (shutdown_close_pipe) TEST_DECLARE (shutdown_eof) +TEST_DECLARE (shutdown_twice) TEST_DECLARE (callback_stack) TEST_DECLARE (error_message) TEST_DECLARE (timer) @@ -344,6 +345,9 @@ TASK_LIST_START TEST_ENTRY (shutdown_eof) TEST_HELPER (shutdown_eof, tcp4_echo_server) + TEST_ENTRY (shutdown_twice) + TEST_HELPER (shutdown_twice, tcp4_echo_server) + TEST_ENTRY (callback_stack) TEST_HELPER (callback_stack, tcp4_echo_server) diff --git a/deps/uv/test/test-shutdown-twice.c b/deps/uv/test/test-shutdown-twice.c new file mode 100644 index 000000000..7ce3e04a2 --- /dev/null +++ b/deps/uv/test/test-shutdown-twice.c @@ -0,0 +1,83 @@ +/* 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. + */ + +/* + * This is a regression test for issue #1113 (calling uv_shutdown twice will + * leave a ghost request in the system) + */ + +#include "uv.h" +#include "task.h" + +static uv_shutdown_t req1; +static uv_shutdown_t req2; + +static int shutdown_cb_called = 0; + +static void close_cb(uv_handle_t* handle) { + +} + +static void shutdown_cb(uv_shutdown_t* req, int status) { + ASSERT(req == &req1); + ASSERT(status == 0); + shutdown_cb_called++; + uv_close((uv_handle_t*) req->handle, close_cb); +} + +static void connect_cb(uv_connect_t* req, int status) { + int r; + + ASSERT(status == 0); + + r = uv_shutdown(&req1, req->handle, shutdown_cb); + ASSERT(r == 0); + r = uv_shutdown(&req2, req->handle, shutdown_cb); + ASSERT(r != 0); + +} + +TEST_IMPL(shutdown_twice) { + struct sockaddr_in addr = uv_ip4_addr("127.0.0.1", TEST_PORT); + uv_loop_t* loop; + int r; + uv_tcp_t h; + + uv_connect_t connect_req; + + loop = uv_default_loop(); + + r = uv_tcp_init(loop, &h); + + r = uv_tcp_connect(&connect_req, + &h, + addr, + connect_cb); + ASSERT(r == 0); + + r = uv_run(uv_default_loop(), UV_RUN_DEFAULT); + ASSERT(r == 0); + + ASSERT(shutdown_cb_called == 1); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/deps/uv/uv.gyp b/deps/uv/uv.gyp index ea8707b79..4e87dc1a3 100644 --- a/deps/uv/uv.gyp +++ b/deps/uv/uv.gyp @@ -329,6 +329,7 @@ 'test/test-semaphore.c', 'test/test-shutdown-close.c', 'test/test-shutdown-eof.c', + 'test/test-shutdown-twice.c', 'test/test-signal.c', 'test/test-signal-multiple-loops.c', 'test/test-spawn.c', |