Permalink
Browse files

uv: Upgrade to v0.10.25

  • Loading branch information...
1 parent abbde2f commit c2aea3747dafaa979c9d21cc7acead32324bfb3a @tjfontaine tjfontaine committed Feb 18, 2014
View
@@ -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>
View
@@ -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:
View
@@ -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 \
@@ -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++);
}
View
@@ -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);
View
@@ -303,18 +303,20 @@ 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,
(uintptr_t) &handle->fo,
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);
View
@@ -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
View
@@ -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;
}
}
View
@@ -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)
@@ -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;
+}
View
@@ -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',

0 comments on commit c2aea37

Please sign in to comment.