diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2012-05-28 00:32:16 +0200 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2012-05-28 00:32:16 +0200 |
commit | 0fd28345392c2a16dfe143d2467ab14a236ce3c3 (patch) | |
tree | 01e5f95ddd008a4e8606c60d295123623f27398b | |
parent | 1f3e4a76f9cb06fae57f7c81371cc5e1351a7977 (diff) | |
download | node-new-0fd28345392c2a16dfe143d2467ab14a236ce3c3.tar.gz |
deps: upgrade libuv to 2ec0986
-rw-r--r-- | deps/uv/src/unix/timer.c | 11 | ||||
-rw-r--r-- | deps/uv/src/uv-common.h | 6 | ||||
-rw-r--r-- | deps/uv/test/runner.c | 6 | ||||
-rw-r--r-- | deps/uv/test/test-ipc-send-recv.c | 5 | ||||
-rw-r--r-- | deps/uv/test/test-list.h | 2 | ||||
-rw-r--r-- | deps/uv/test/test-pipe-bind-error.c | 4 | ||||
-rw-r--r-- | deps/uv/test/test-timer.c | 22 |
7 files changed, 38 insertions, 18 deletions
diff --git a/deps/uv/src/unix/timer.c b/deps/uv/src/unix/timer.c index 8463088ac9..e50a35abc6 100644 --- a/deps/uv/src/unix/timer.c +++ b/deps/uv/src/unix/timer.c @@ -52,11 +52,12 @@ int uv_timer_init(uv_loop_t* loop, uv_timer_t* timer) { } -int uv_timer_start(uv_timer_t* timer, uv_timer_cb cb, int64_t timeout, - int64_t repeat) { - if (uv__is_active(timer)) { - return -1; - } +int uv_timer_start(uv_timer_t* timer, + uv_timer_cb cb, + int64_t timeout, + int64_t repeat) { + if (uv__is_active(timer)) + uv_timer_stop(timer); timer->timer_cb = cb; diff --git a/deps/uv/src/uv-common.h b/deps/uv/src/uv-common.h index 7bf6db81ec..cede20ba6d 100644 --- a/deps/uv/src/uv-common.h +++ b/deps/uv/src/uv-common.h @@ -155,16 +155,14 @@ UNUSED static int uv__is_active(const uv_handle_t* h) { UNUSED static void uv__handle_start(uv_handle_t* h) { if (h->flags & UV__ACTIVE) return; - if (!(h->flags & UV__REF)) return; + if (h->flags & UV__REF) uv__active_handle_add(h); h->flags |= UV__ACTIVE; - uv__active_handle_add(h); } #define uv__handle_start(h) uv__handle_start((uv_handle_t*)(h)) UNUSED static void uv__handle_stop(uv_handle_t* h) { if (!(h->flags & UV__ACTIVE)) return; - if (!(h->flags & UV__REF)) return; - uv__active_handle_rm(h); + if (h->flags & UV__REF) uv__active_handle_rm(h); h->flags &= ~UV__ACTIVE; } #define uv__handle_stop(h) uv__handle_stop((uv_handle_t*)(h)) diff --git a/deps/uv/test/runner.c b/deps/uv/test/runner.c index 78b0f21160..1bda48066a 100644 --- a/deps/uv/test/runner.c +++ b/deps/uv/test/runner.c @@ -19,6 +19,7 @@ * IN THE SOFTWARE. */ +#include <stdio.h> #include <string.h> #include "runner.h" @@ -92,6 +93,11 @@ int run_test(const char* test, int timeout, int benchmark_output) { main_proc = NULL; process_count = 0; +#ifndef _WIN32 + /* Clean up stale socket from previous run. */ + remove(TEST_PIPENAME); +#endif + /* If it's a helper the user asks for, start it directly. */ for (task = TASKS; task->main; task++) { if (task->is_helper && strcmp(test, task->process_name) == 0) { diff --git a/deps/uv/test/test-ipc-send-recv.c b/deps/uv/test/test-ipc-send-recv.c index faedc5469d..970bf1effe 100644 --- a/deps/uv/test/test-ipc-send-recv.c +++ b/deps/uv/test/test-ipc-send-recv.c @@ -120,11 +120,6 @@ TEST_IMPL(ipc_send_recv_pipe) { r = uv_pipe_init(uv_default_loop(), &ctx.send.pipe, 1); ASSERT(r == 0); -#ifndef _WIN32 - /* Clean up stale socket from previous test run. */ - remove(TEST_PIPENAME); -#endif - r = uv_pipe_bind(&ctx.send.pipe, TEST_PIPENAME); ASSERT(r == 0); diff --git a/deps/uv/test/test-list.h b/deps/uv/test/test-list.h index 2466b570e7..63683f28ed 100644 --- a/deps/uv/test/test-list.h +++ b/deps/uv/test/test-list.h @@ -77,6 +77,7 @@ TEST_DECLARE (callback_stack) TEST_DECLARE (error_message) TEST_DECLARE (timer) TEST_DECLARE (timer_again) +TEST_DECLARE (timer_start_twice) TEST_DECLARE (idle_starvation) TEST_DECLARE (loop_handles) TEST_DECLARE (get_loadavg) @@ -266,6 +267,7 @@ TASK_LIST_START TEST_ENTRY (timer) TEST_ENTRY (timer_again) + TEST_ENTRY (timer_start_twice) TEST_ENTRY (idle_starvation) diff --git a/deps/uv/test/test-pipe-bind-error.c b/deps/uv/test/test-pipe-bind-error.c index 4e73b639b6..b84d20f1ea 100644 --- a/deps/uv/test/test-pipe-bind-error.c +++ b/deps/uv/test/test-pipe-bind-error.c @@ -27,10 +27,8 @@ #ifdef _WIN32 # define BAD_PIPENAME "bad-pipe" -# define UNLINK_PIPE(name) #else # define BAD_PIPENAME "/path/to/unix/socket/that/really/should/not/be/there" -# define UNLINK_PIPE(name) remove(name) #endif @@ -47,8 +45,6 @@ TEST_IMPL(pipe_bind_error_addrinuse) { uv_pipe_t server1, server2; int r; - UNLINK_PIPE(TEST_PIPENAME); - r = uv_pipe_init(uv_default_loop(), &server1, 0); ASSERT(r == 0); r = uv_pipe_bind(&server1, TEST_PIPENAME); diff --git a/deps/uv/test/test-timer.c b/deps/uv/test/test-timer.c index c961aff49e..c1b629b2fb 100644 --- a/deps/uv/test/test-timer.c +++ b/deps/uv/test/test-timer.c @@ -35,6 +35,7 @@ static void once_close_cb(uv_handle_t* handle) { printf("ONCE_CLOSE_CB\n"); ASSERT(handle != NULL); + ASSERT(!uv_is_active(handle)); once_close_cb_called++; } @@ -45,6 +46,7 @@ static void once_cb(uv_timer_t* handle, int status) { ASSERT(handle != NULL); ASSERT(status == 0); + ASSERT(!uv_is_active((uv_handle_t*)handle)); once_cb_called++; @@ -69,6 +71,7 @@ static void repeat_cb(uv_timer_t* handle, int status) { ASSERT(handle != NULL); ASSERT(status == 0); + ASSERT(uv_is_active((uv_handle_t*)handle)); repeat_cb_called++; @@ -128,3 +131,22 @@ TEST_IMPL(timer) { return 0; } + + +TEST_IMPL(timer_start_twice) { + uv_timer_t once; + int r; + + r = uv_timer_init(uv_default_loop(), &once); + ASSERT(r == 0); + r = uv_timer_start(&once, never_cb, 86400 * 1000, 0); + ASSERT(r == 0); + r = uv_timer_start(&once, once_cb, 10, 0); + ASSERT(r == 0); + r = uv_run(uv_default_loop()); + ASSERT(r == 0); + + ASSERT(once_cb_called == 1); + + return 0; +} |