@ -91,7 +91,7 @@ static void NewQueryReqWrap(const FunctionCallbackInfo<Value>& args) {
}
}
static int cmp_ares_tasks ( const ares_task_t * a , const ares_task_t * b ) {
static int cmp_ares_tasks ( const node_ ares_task* a , const node_ ares_task* b ) {
if ( a - > sock < b - > sock )
if ( a - > sock < b - > sock )
return - 1 ;
return - 1 ;
if ( a - > sock > b - > sock )
if ( a - > sock > b - > sock )
@ -100,7 +100,7 @@ static int cmp_ares_tasks(const ares_task_t* a, const ares_task_t* b) {
}
}
RB_GENERATE_STATIC ( ares_task_list , ares_task_t , node , cmp_ares_tasks )
RB_GENERATE_STATIC ( node_ ares_task_list, node_ ares_task, node , cmp_ares_tasks )
@ -114,7 +114,7 @@ static void ares_timeout(uv_timer_t* handle) {
static void ares_poll_cb ( uv_poll_t * watcher , int status , int events ) {
static void ares_poll_cb ( uv_poll_t * watcher , int status , int events ) {
ares_task_t * task = ContainerOf ( & ares_task_t : : poll_watcher , watcher ) ;
node_ ares_task* task = ContainerOf ( & node_ ares_task: : poll_watcher , watcher ) ;
Environment * env = task - > env ;
Environment * env = task - > env ;
/* Reset the idle timer */
/* Reset the idle timer */
@ -135,15 +135,15 @@ static void ares_poll_cb(uv_poll_t* watcher, int status, int events) {
static void ares_poll_close_cb ( uv_handle_t * watcher ) {
static void ares_poll_close_cb ( uv_handle_t * watcher ) {
ares_task_t * task = ContainerOf ( & ares_task_t : : poll_watcher ,
node_ ares_task* task = ContainerOf ( & node_ ares_task: : poll_watcher ,
reinterpret_cast < uv_poll_t * > ( watcher ) ) ;
reinterpret_cast < uv_poll_t * > ( watcher ) ) ;
free ( task ) ;
free ( task ) ;
}
}
/* Allocates and returns a new ares_task_t */
/* Allocates and returns a new node_ ares_task */
static ares_task_t * ares_task_create ( Environment * env , ares_socket_t sock ) {
static node_ ares_task* ares_task_create ( Environment * env , ares_socket_t sock ) {
ares_task_t * task = static_cast < ares_task_t * > ( malloc ( sizeof ( * task ) ) ) ;
node_ ares_task* task = static_cast < node_ ares_task* > ( malloc ( sizeof ( * task ) ) ) ;
if ( task = = nullptr ) {
if ( task = = nullptr ) {
/* Out of memory. */
/* Out of memory. */
@ -169,11 +169,11 @@ static void ares_sockstate_cb(void* data,
int read ,
int read ,
int write ) {
int write ) {
Environment * env = static_cast < Environment * > ( data ) ;
Environment * env = static_cast < Environment * > ( data ) ;
ares_task_t * task ;
node_ ares_task* task ;
ares_task_t lookup_task ;
node_ ares_task lookup_task ;
lookup_task . sock = sock ;
lookup_task . sock = sock ;
task = RB_FIND ( ares_task_list , env - > cares_task_list ( ) , & lookup_task ) ;
task = RB_FIND ( node_ ares_task_list, env - > cares_task_list ( ) , & lookup_task ) ;
if ( read | | write ) {
if ( read | | write ) {
if ( ! task ) {
if ( ! task ) {
@ -194,7 +194,7 @@ static void ares_sockstate_cb(void* data,
return ;
return ;
}
}
RB_INSERT ( ares_task_list , env - > cares_task_list ( ) , task ) ;
RB_INSERT ( node_ ares_task_list, env - > cares_task_list ( ) , task ) ;
}
}
/* This should never fail. If it fails anyway, the query will eventually */
/* This should never fail. If it fails anyway, the query will eventually */
@ -210,7 +210,7 @@ static void ares_sockstate_cb(void* data,
CHECK ( task & &
CHECK ( task & &
" When an ares socket is closed we should have a handle for it " ) ;
" When an ares socket is closed we should have a handle for it " ) ;
RB_REMOVE ( ares_task_list , env - > cares_task_list ( ) , task ) ;
RB_REMOVE ( node_ ares_task_list, env - > cares_task_list ( ) , task ) ;
uv_close ( reinterpret_cast < uv_handle_t * > ( & task - > poll_watcher ) ,
uv_close ( reinterpret_cast < uv_handle_t * > ( & task - > poll_watcher ) ,
ares_poll_close_cb ) ;
ares_poll_close_cb ) ;