uv: upgrade to 9f44b0e3
authorBert Belder <bertbelder@gmail.com>
Tue, 12 Jun 2012 23:35:51 +0000 (01:35 +0200)
committerBert Belder <bertbelder@gmail.com>
Tue, 12 Jun 2012 23:35:51 +0000 (01:35 +0200)
14 files changed:
deps/uv/src/unix/core.c
deps/uv/src/uv-common.h
deps/uv/src/win/async.c
deps/uv/src/win/fs-event.c
deps/uv/src/win/handle-inl.h
deps/uv/src/win/loop-watcher.c
deps/uv/src/win/pipe.c
deps/uv/src/win/poll.c
deps/uv/src/win/process.c
deps/uv/src/win/stream-inl.h
deps/uv/src/win/tcp.c
deps/uv/src/win/timer.c
deps/uv/src/win/tty.c
deps/uv/src/win/udp.c

index ca74fb321ab563e6a7a1878da6c73dbc96dca6c8..1296aae11e2b5ca47bba8015674f32d8545a6e0f 100644 (file)
@@ -271,18 +271,6 @@ int uv_run_once(uv_loop_t* loop) {
 }
 
 
-void uv__handle_init(uv_loop_t* loop, uv_handle_t* handle,
-    uv_handle_type type) {
-  loop->counters.handle_init++;
-
-  handle->loop = loop;
-  handle->type = type;
-  handle->flags = UV__HANDLE_REF; /* ref the loop when active */
-  handle->next_closing = NULL;
-  ngx_queue_insert_tail(&loop->handle_queue, &handle->handle_queue);
-}
-
-
 void uv_update_time(uv_loop_t* loop) {
   loop->time = uv_hrtime() / 1000000;
 }
index c86cb7daa04421df1f5bf4e71a1dc54775ae0dab..4c316ec11d4155dcfa4d384e79c8c71de86a56dc 100644 (file)
@@ -153,4 +153,17 @@ UNUSED static void uv__handle_unref(uv_handle_t* h) {
 }
 #define uv__handle_unref(h) uv__handle_unref((uv_handle_t*)(h))
 
+UNUSED static void uv__handle_init(uv_loop_t* loop,
+                                   uv_handle_t* handle,
+                                   uv_handle_type type) {
+  loop->counters.handle_init++;
+  handle->loop = loop;
+  handle->type = type;
+  handle->flags = UV__HANDLE_REF; /* ref the loop when active */
+  ngx_queue_insert_tail(&loop->handle_queue, &handle->handle_queue);
+#ifndef _WIN32
+  handle->next_closing = NULL;
+#endif
+}
+
 #endif /* UV_COMMON_H_ */
index 1848023709e449f2e5b3e79bc8cc74104c877a77..1b733c400e34b3a1e3f982f1960faa6f49a04a27 100644 (file)
@@ -69,8 +69,7 @@ void uv_async_endgame(uv_loop_t* loop, uv_async_t* handle) {
 int uv_async_init(uv_loop_t* loop, uv_async_t* handle, uv_async_cb async_cb) {
   uv_req_t* req;
 
-  uv_handle_init(loop, (uv_handle_t*) handle);
-  handle->type = UV_ASYNC;
+  uv__handle_init(loop, (uv_handle_t*) handle, UV_ASYNC);
   handle->async_sent = 0;
   handle->async_cb = async_cb;
 
index ccf941d1bbe14afee6942bd51680f63ebf062606..68e03e390b8a31ed5c6e56b305f91cb9f70ac678 100644 (file)
@@ -36,8 +36,7 @@ const unsigned int uv_directory_watcher_buffer_size = 4096;
 
 static void uv_fs_event_init_handle(uv_loop_t* loop, uv_fs_event_t* handle,
     const char* filename, uv_fs_event_cb cb) {
-  uv_handle_init(loop, (uv_handle_t*) handle);
-  handle->type = UV_FS_EVENT;
+  uv__handle_init(loop, (uv_handle_t*) handle, UV_FS_EVENT);
   handle->cb = cb;
   handle->dir_handle = INVALID_HANDLE_VALUE;
   handle->buffer = NULL;
index f069dd192f3084c0f9b1b235fd1c5910f5935da3..ea2d9e0bc5f66df3ffc2fabc3f8dea56148eaebc 100644 (file)
   } while (0)
 
 
-INLINE static void uv_handle_init(uv_loop_t* loop, uv_handle_t* handle) {
-  handle->loop = loop;
-  handle->flags = UV__HANDLE_REF;
-  ngx_queue_insert_tail(&loop->handle_queue, &handle->handle_queue);
-
-  loop->counters.handle_init++;
-}
-
-
 INLINE static void uv_want_endgame(uv_loop_t* loop, uv_handle_t* handle) {
   if (!(handle->flags & UV_HANDLE_ENDGAME_QUEUED)) {
     handle->flags |= UV_HANDLE_ENDGAME_QUEUED;
index a753a0632ad281bf6a2022efc62cf88b0f3f5fc9..615f7cdeb72397a27b41202f2b0254c4ad6be274 100644 (file)
@@ -38,8 +38,7 @@ void uv_loop_watcher_endgame(uv_loop_t* loop, uv_handle_t* handle) {
 
 #define UV_LOOP_WATCHER_DEFINE(name, NAME)                                    \
   int uv_##name##_init(uv_loop_t* loop, uv_##name##_t* handle) {              \
-    uv_handle_init(loop, (uv_handle_t*) handle);                              \
-    handle->type = UV_##NAME;                                                 \
+    uv__handle_init(loop, (uv_handle_t*) handle, UV_##NAME);                  \
     loop->counters.name##_init++;                                             \
                                                                               \
     return 0;                                                                 \
index 0551047123b0262620ce3939101c3859b7d2a9dc..77a1c7b7575abd7b6ca1730ea4e4d940d96bf8ab 100644 (file)
@@ -74,9 +74,8 @@ static void uv_unique_pipe_name(char* ptr, char* name, size_t size) {
 
 
 int uv_pipe_init(uv_loop_t* loop, uv_pipe_t* handle, int ipc) {
-  uv_stream_init(loop, (uv_stream_t*)handle);
+  uv_stream_init(loop, (uv_stream_t*)handle, UV_NAMED_PIPE);
 
-  handle->type = UV_NAMED_PIPE;
   handle->reqs_pending = 0;
   handle->handle = INVALID_HANDLE_VALUE;
   handle->name = NULL;
index ba31ae9efb6793d82d432b1ad1fec3a0ea4ee7c2..9800b71624a96a1170cd3da8f386ed8c3e1c5036 100644 (file)
@@ -519,8 +519,7 @@ int uv_poll_init_socket(uv_loop_t* loop, uv_poll_t* handle,
     socket = base_socket;
   }
 
-  uv_handle_init(loop, (uv_handle_t*) handle);
-  handle->type = UV_POLL;
+  uv__handle_init(loop, (uv_handle_t*) handle, UV_POLL);
   handle->socket = socket;
   handle->events = 0;
 
index a2bd33b8795ab2c556473372658a47511401338f..4166de8a3b280b1e9d6ed65e813b8dd66dc3970e 100644 (file)
@@ -101,8 +101,7 @@ typedef struct env_var {
 
 
 static void uv_process_init(uv_loop_t* loop, uv_process_t* handle) {
-  uv_handle_init(loop, (uv_handle_t*) handle);
-  handle->type = UV_PROCESS;
+  uv__handle_init(loop, (uv_handle_t*) handle, UV_PROCESS);
   handle->exit_cb = NULL;
   handle->pid = 0;
   handle->exit_signal = 0;
@@ -1093,7 +1092,7 @@ static int init_child_stdio(uv_loop_t* loop, uv_process_options_t* options,
         uv_stream_t* stream = fdopt.data.stream;
 
         /* Leech the handle out of the stream. */
-        if (stream->type = UV_TTY) {
+        if (stream->type == UV_TTY) {
           stream_handle = ((uv_tty_t*) stream)->handle;
           crt_flags = FOPEN | FDEV;
         } else if (stream->type == UV_NAMED_PIPE &&
index 91313566a186b8671b6049bfcd5dd76a6c46cf26..7e2311c6b5d9d16d9780ec8abffcee927a5be816 100644 (file)
 #include "req-inl.h"
 
 
-INLINE static void uv_stream_init(uv_loop_t* loop, uv_stream_t* handle) {
-  uv_handle_init(loop, (uv_handle_t*) handle);
+INLINE static void uv_stream_init(uv_loop_t* loop,
+                                  uv_stream_t* handle,
+                                  uv_handle_type type) {
+  uv__handle_init(loop, (uv_handle_t*) handle, type);
   handle->write_queue_size = 0;
   handle->activecnt = 0;
 
index 6ea39a2b0d30e7a25d6843b82298b5d51cdfcc3d..daef567134c8a9170c0d9b56ce759c97e11d5c58 100644 (file)
@@ -146,9 +146,8 @@ static int uv_tcp_set_socket(uv_loop_t* loop, uv_tcp_t* handle,
 
 
 int uv_tcp_init(uv_loop_t* loop, uv_tcp_t* handle) {
-  uv_stream_init(loop, (uv_stream_t*) handle);
+  uv_stream_init(loop, (uv_stream_t*) handle, UV_TCP);
 
-  handle->type = UV_TCP;
   handle->accept_reqs = NULL;
   handle->pending_accepts = NULL;
   handle->socket = INVALID_SOCKET;
index 5ddcfca1f3fcc42cdca959e6473c0bc64ac5d028..94b7b219c215ebadf7e18ab9d1fec31ac3e0697a 100644 (file)
@@ -67,8 +67,7 @@ RB_GENERATE_STATIC(uv_timer_tree_s, uv_timer_s, tree_entry, uv_timer_compare);
 
 
 int uv_timer_init(uv_loop_t* loop, uv_timer_t* handle) {
-  uv_handle_init(loop, (uv_handle_t*) handle);
-  handle->type = UV_TIMER;
+  uv__handle_init(loop, (uv_handle_t*) handle, UV_TIMER);
   handle->timer_cb = NULL;
   handle->repeat = 0;
 
index 047cad26fa7c5b0f4c2c01fd3f3efe96cd72e88e..340bcdcb3f58b0b8d9a976a948532145ab23d591 100644 (file)
@@ -112,10 +112,9 @@ int uv_tty_init(uv_loop_t* loop, uv_tty_t* tty, uv_file fd, int readable) {
     LeaveCriticalSection(&uv_tty_output_lock);
   }
 
-  uv_stream_init(loop, (uv_stream_t*) tty);
+  uv_stream_init(loop, (uv_stream_t*) tty, UV_TTY);
   uv_connection_init((uv_stream_t*) tty);
 
-  tty->type = UV_TTY;
   tty->handle = win_handle;
   tty->read_line_handle = NULL;
   tty->read_line_buffer = uv_null_buf_;
index 10cca00afe4e5a520e5bda185cd0ac3b247448ce..3f19fe303e704223aa2265629f88e23b85c1effb 100644 (file)
@@ -123,9 +123,8 @@ static int uv_udp_set_socket(uv_loop_t* loop, uv_udp_t* handle,
 
 
 int uv_udp_init(uv_loop_t* loop, uv_udp_t* handle) {
-  uv_handle_init(loop, (uv_handle_t*) handle);
+  uv__handle_init(loop, (uv_handle_t*) handle, UV_UDP);
 
-  handle->type = UV_UDP;
   handle->socket = INVALID_SOCKET;
   handle->reqs_pending = 0;
   handle->activecnt = 0;