summaryrefslogtreecommitdiff
path: root/deps/uv/src/unix/udp.c
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2012-05-17 07:13:29 +0200
committerBen Noordhuis <info@bnoordhuis.nl>2012-05-22 16:14:24 +0200
commit039fac633eaf081a96bb1ed8bc7307d03dcbe9d9 (patch)
treeb24085e8aab84e09ed8fd7d311cd360dbfd6259e /deps/uv/src/unix/udp.c
parenta608f65b2454a83f08a60ba24088a672097540f5 (diff)
downloadandroid-node-v8-039fac633eaf081a96bb1ed8bc7307d03dcbe9d9.tar.gz
android-node-v8-039fac633eaf081a96bb1ed8bc7307d03dcbe9d9.tar.bz2
android-node-v8-039fac633eaf081a96bb1ed8bc7307d03dcbe9d9.zip
deps: upgrade libuv to a478847
The event loop's reference counting scheme in this version of libuv has changed. Update the libuv bindings to reflect that fact.
Diffstat (limited to 'deps/uv/src/unix/udp.c')
-rw-r--r--deps/uv/src/unix/udp.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/deps/uv/src/unix/udp.c b/deps/uv/src/unix/udp.c
index 105bdc048a..c67dcc2c9d 100644
--- a/deps/uv/src/unix/udp.c
+++ b/deps/uv/src/unix/udp.c
@@ -46,16 +46,20 @@ static void uv__udp_start_watcher(uv_udp_t* handle,
ev_set_cb(w, cb);
ev_io_set(w, handle->fd, flags);
ev_io_start(handle->loop->ev, w);
- ev_unref(handle->loop->ev);
+ uv__handle_start(handle);
}
static void uv__udp_stop_watcher(uv_udp_t* handle, ev_io* w) {
if (!ev_is_active(w)) return;
- ev_ref(handle->loop->ev);
ev_io_stop(handle->loop->ev, w);
ev_io_set(w, -1, 0);
ev_set_cb(w, NULL);
+
+ if (!ev_is_active(&handle->read_watcher) &&
+ !ev_is_active(&handle->write_watcher)) {
+ uv__handle_stop(handle);
+ }
}
@@ -108,6 +112,8 @@ void uv__udp_finish_close(uv_udp_t* handle) {
ngx_queue_remove(q);
req = ngx_queue_data(q, uv_udp_send_t, queue);
+ uv__req_unregister(handle->loop, req);
+
if (req->send_cb) {
/* FIXME proper error code like UV_EABORTED */
uv__set_artificial_error(handle->loop, UV_EINTR);
@@ -185,12 +191,10 @@ static void uv__udp_run_completed(uv_udp_t* handle) {
while (!ngx_queue_empty(&handle->write_completed_queue)) {
q = ngx_queue_head(&handle->write_completed_queue);
- assert(q != NULL);
-
ngx_queue_remove(q);
req = ngx_queue_data(q, uv_udp_send_t, queue);
- assert(req != NULL);
+ uv__req_unregister(handle->loop, req);
if (req->bufs != req->bufsml)
free(req->bufs);