diff --git a/include/uv.h b/include/uv.h index f065b9d9..6f302dcd 100644 --- a/include/uv.h +++ b/include/uv.h @@ -229,7 +229,7 @@ int uv_is_active(uv_handle_t* handle); * Request handle to be closed. close_cb will be called asynchronously after * this call. This MUST be called on each handle before memory is released. */ -int uv_close(uv_handle_t* handle, uv_close_cb close_cb); +void uv_close(uv_handle_t* handle, uv_close_cb close_cb); #define UV_STREAM_FIELDS \ diff --git a/src/uv-unix.c b/src/uv-unix.c index d583c378..34b92970 100644 --- a/src/uv-unix.c +++ b/src/uv-unix.c @@ -186,7 +186,7 @@ static uv_err_t uv_err_new(uv_handle_t* handle, int sys_error) { } -int uv_close(uv_handle_t* handle, uv_close_cb close_cb) { +void uv_close(uv_handle_t* handle, uv_close_cb close_cb) { uv_tcp_t* tcp; uv_pipe_t* pipe; uv_async_t* async; @@ -245,7 +245,6 @@ int uv_close(uv_handle_t* handle, uv_close_cb close_cb) { default: assert(0); - return -1; } uv_flag_set(handle, UV_CLOSING); @@ -254,8 +253,6 @@ int uv_close(uv_handle_t* handle, uv_close_cb close_cb) { ev_idle_start(EV_DEFAULT_ &handle->next_watcher); ev_feed_event(EV_DEFAULT_ &handle->next_watcher, EV_IDLE); assert(ev_is_pending(&handle->next_watcher)); - - return 0; } diff --git a/src/win/handle.c b/src/win/handle.c index 91dfba80..d5da22bf 100644 --- a/src/win/handle.c +++ b/src/win/handle.c @@ -111,9 +111,9 @@ static int uv_close_error(uv_handle_t* handle, uv_err_t e) { } -int uv_close(uv_handle_t* handle, uv_close_cb close_cb) { +void uv_close(uv_handle_t* handle, uv_close_cb close_cb) { handle->close_cb = close_cb; - return uv_close_error(handle, uv_ok_); + uv_close_error(handle, uv_ok_); } diff --git a/test/test-async.c b/test/test-async.c index f91d9b45..25898fa4 100644 --- a/test/test-async.c +++ b/test/test-async.c @@ -170,8 +170,7 @@ static void prepare_cb(uv_prepare_t* handle, int status) { #endif case 1: - r = uv_close((uv_handle_t*)handle, close_cb); - ASSERT(r == 0); + uv_close((uv_handle_t*)handle, close_cb); break; default: diff --git a/test/test-callback-stack.c b/test/test-callback-stack.c index 4162b221..6582010a 100644 --- a/test/test-callback-stack.c +++ b/test/test-callback-stack.c @@ -83,9 +83,7 @@ static void read_cb(uv_stream_t* tcp, ssize_t nread, uv_buf_t buf) { ASSERT(uv_last_error().code == UV_EOF); nested++; - if (uv_close((uv_handle_t*)tcp, close_cb)) { - FATAL("uv_close failed"); - } + uv_close((uv_handle_t*)tcp, close_cb); nested--; return; @@ -111,8 +109,6 @@ static void read_cb(uv_stream_t* tcp, ssize_t nread, uv_buf_t buf) { static void timer_cb(uv_timer_t* handle, int status) { - int r; - ASSERT(handle == &timer); ASSERT(status == 0); ASSERT(nested == 0 && "timer_cb must be called from a fresh stack"); @@ -127,8 +123,7 @@ static void timer_cb(uv_timer_t* handle, int status) { timer_cb_called++; - r = uv_close((uv_handle_t*)handle, close_cb); - ASSERT(r == 0); + uv_close((uv_handle_t*)handle, close_cb); } diff --git a/test/test-delayed-accept.c b/test/test-delayed-accept.c index 30b63b9b..8e3dfc14 100644 --- a/test/test-delayed-accept.c +++ b/test/test-delayed-accept.c @@ -71,18 +71,15 @@ static void do_accept(uv_timer_t* timer_handle, int status) { do_accept_called++; /* Immediately close the accepted handle. */ - r = uv_close((uv_handle_t*)accepted_handle, close_cb); - ASSERT(r == 0); + uv_close((uv_handle_t*)accepted_handle, close_cb); /* After accepting the two clients close the server handle */ if (do_accept_called == 2) { - r = uv_close((uv_handle_t*)server, close_cb); - ASSERT(r == 0); + uv_close((uv_handle_t*)server, close_cb); } /* Dispose the timer. */ - r = uv_close((uv_handle_t*)timer_handle, close_cb); - ASSERT(r == 0); + uv_close((uv_handle_t*)timer_handle, close_cb); } diff --git a/test/test-idle.c b/test/test-idle.c index 5c226c77..7144e1bb 100644 --- a/test/test-idle.c +++ b/test/test-idle.c @@ -37,15 +37,11 @@ static void close_cb(uv_handle_t* handle) { static void timer_cb(uv_timer_t* handle, int status) { - int r; - ASSERT(handle == &timer_handle); ASSERT(status == 0); - r = uv_close((uv_handle_t*) &idle_handle, close_cb); - ASSERT(r == 0); - r = uv_close((uv_handle_t*) &idle_handle, close_cb); - ASSERT(r == 0); + uv_close((uv_handle_t*) &idle_handle, close_cb); + uv_close((uv_handle_t*) &idle_handle, close_cb); timer_cb_called++; } @@ -83,4 +79,4 @@ TEST_IMPL(idle_starvation) { ASSERT(close_cb_called == 2); return 0; -} \ No newline at end of file +} diff --git a/test/test-loop-handles.c b/test/test-loop-handles.c index 7979a74b..2e858c1d 100644 --- a/test/test-loop-handles.c +++ b/test/test-loop-handles.c @@ -130,8 +130,6 @@ static void idle_2_close_cb(uv_handle_t* handle) { static void idle_2_cb(uv_idle_t* handle, int status) { - int r; - LOG("IDLE_2_CB\n"); ASSERT(handle == &idle_2_handle); @@ -139,8 +137,7 @@ static void idle_2_cb(uv_idle_t* handle, int status) { idle_2_cb_called++; - r = uv_close((uv_handle_t*)handle, idle_2_close_cb); - ASSERT(r == 0); + uv_close((uv_handle_t*)handle, idle_2_close_cb); } @@ -230,23 +227,18 @@ static void check_cb(uv_check_t* handle, int status) { } else { /* End of the test - close all handles */ - r = uv_close((uv_handle_t*)&prepare_1_handle, prepare_1_close_cb); - ASSERT(r == 0); - r = uv_close((uv_handle_t*)&check_handle, check_close_cb); - ASSERT(r == 0); - r = uv_close((uv_handle_t*)&prepare_2_handle, prepare_2_close_cb); - ASSERT(r == 0); + uv_close((uv_handle_t*)&prepare_1_handle, prepare_1_close_cb); + uv_close((uv_handle_t*)&check_handle, check_close_cb); + uv_close((uv_handle_t*)&prepare_2_handle, prepare_2_close_cb); for (i = 0; i < IDLE_COUNT; i++) { - r = uv_close((uv_handle_t*)&idle_1_handles[i], idle_1_close_cb); - ASSERT(r == 0); + uv_close((uv_handle_t*)&idle_1_handles[i], idle_1_close_cb); } /* This handle is closed/recreated every time, close it only if it is */ /* active.*/ if (idle_2_is_active) { - r = uv_close((uv_handle_t*)&idle_2_handle, idle_2_close_cb); - ASSERT(r == 0); + uv_close((uv_handle_t*)&idle_2_handle, idle_2_close_cb); } }