From d51840efd77a891d5988c4a60a924be175dee239 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Wed, 5 Mar 2014 10:30:02 +0100 Subject: [PATCH] Removed uv_data->polling field It's not necessary as uv_is_active can be used to check if a handle is started or not. --- src/extension/libuv.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/extension/libuv.c b/src/extension/libuv.c index 40a5f9e8..30ddad1a 100644 --- a/src/extension/libuv.c +++ b/src/extension/libuv.c @@ -44,7 +44,6 @@ struct getdns_libuv_data { uv_loop_t* loop; uv_poll_t* poll_handle; - uint8_t polling; }; static void request_count_changed(uint32_t request_count, struct getdns_libuv_data *uv_data); @@ -65,12 +64,10 @@ getdns_libuv_cb(uv_poll_t* handle, int status, int events) { static void request_count_changed(uint32_t request_count, struct getdns_libuv_data *uv_data) { - if (request_count > 0 && uv_data->polling == 0) { + if (request_count > 0 && !uv_is_active((uv_handle_t*) uv_data->poll_handle)) { uv_poll_start(uv_data->poll_handle, UV_READABLE, getdns_libuv_cb); - uv_data->polling = 1; - } else if (request_count == 0 && uv_data->polling == 1) { + } else if (request_count == 0 && uv_is_active((uv_handle_t*) uv_data->poll_handle)) { uv_poll_stop(uv_data->poll_handle); - uv_data->polling = 0; } } @@ -169,6 +166,5 @@ getdns_extension_set_libuv_loop(struct getdns_context *context, uv_poll_init(uv_loop, uv_data->poll_handle, fd); uv_data->poll_handle->data = context; uv_data->loop = uv_loop; - uv_data->polling = 0; return getdns_extension_set_eventloop(context, &LIBUV_EXT, uv_data); } /* getdns_extension_set_libuv_loop */