| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent fa9e6f7 commit 84dd526
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -91,7 +91,7 @@ static void NewQueryReqWrap(const FunctionCallbackInfo<Value>& args) { | |||
| 91 | 91 | } | |
| 92 | 92 | ||
| 93 | 93 | ||
| 94 | - static int cmp_ares_tasks(const ares_task_t* a, const ares_task_t* b) { | ||
| 94 | + static int cmp_ares_tasks(const node_ares_task* a, const node_ares_task* b) { | ||
| 95 | 95 | if (a->sock < b->sock) | |
| 96 | 96 | return -1; | |
| 97 | 97 | if (a->sock > b->sock) | |
@@ -100,7 +100,7 @@ static int cmp_ares_tasks(const ares_task_t* a, const ares_task_t* b) { | |||
| 100 | 100 | } | |
| 101 | 101 | ||
| 102 | 102 | ||
| 103 | - RB_GENERATE_STATIC(ares_task_list, ares_task_t, node, cmp_ares_tasks) | ||
| 103 | + RB_GENERATE_STATIC(node_ares_task_list, node_ares_task, node, cmp_ares_tasks) | ||
| 104 | 104 | ||
| 105 | 105 | ||
| 106 | 106 | ||
@@ -114,7 +114,7 @@ static void ares_timeout(uv_timer_t* handle) { | |||
| 114 | 114 | ||
| 115 | 115 | ||
| 116 | 116 | static void ares_poll_cb(uv_poll_t* watcher, int status, int events) { | |
| 117 | - ares_task_t* task = ContainerOf(&ares_task_t::poll_watcher, watcher); | ||
| 117 | + node_ares_task* task = ContainerOf(&node_ares_task::poll_watcher, watcher); | ||
| 118 | 118 | Environment* env = task->env; | |
| 119 | 119 | ||
| 120 | 120 | /* Reset the idle timer */ | |
@@ -135,15 +135,15 @@ static void ares_poll_cb(uv_poll_t* watcher, int status, int events) { | |||
| 135 | 135 | ||
| 136 | 136 | ||
| 137 | 137 | static void ares_poll_close_cb(uv_handle_t* watcher) { | |
| 138 | - ares_task_t* task = ContainerOf(&ares_task_t::poll_watcher, | ||
| 138 | + node_ares_task* task = ContainerOf(&node_ares_task::poll_watcher, | ||
| 139 | 139 | reinterpret_cast<uv_poll_t*>(watcher)); | |
| 140 | 140 | free(task); | |
| 141 | 141 | } | |
| 142 | 142 | ||
| 143 | 143 | ||
| 144 | - /* Allocates and returns a new ares_task_t */ | ||
| 145 | - static ares_task_t* ares_task_create(Environment* env, ares_socket_t sock) { | ||
| 146 | - ares_task_t* task = static_cast<ares_task_t*>(malloc(sizeof(*task))); | ||
| 144 | + /* Allocates and returns a new node_ares_task */ | ||
| 145 | + static node_ares_task* ares_task_create(Environment* env, ares_socket_t sock) { | ||
| 146 | + node_ares_task* task = static_cast<node_ares_task*>(malloc(sizeof(*task))); | ||
| 147 | 147 | ||
| 148 | 148 | if (task == nullptr) { | |
| 149 | 149 | /* Out of memory. */ | |
@@ -169,11 +169,11 @@ static void ares_sockstate_cb(void* data, | |||
| 169 | 169 | int read, | |
| 170 | 170 | int write) { | |
| 171 | 171 | Environment* env = static_cast<Environment*>(data); | |
| 172 | - ares_task_t* task; | ||
| 172 | + node_ares_task* task; | ||
| 173 | 173 | ||
| 174 | - ares_task_t lookup_task; | ||
| 174 | + node_ares_task lookup_task; | ||
| 175 | 175 | lookup_task.sock = sock; | |
| 176 | - task = RB_FIND(ares_task_list, env->cares_task_list(), &lookup_task); | ||
| 176 | + task = RB_FIND(node_ares_task_list, env->cares_task_list(), &lookup_task); | ||
| 177 | 177 | ||
| 178 | 178 | if (read || write) { | |
| 179 | 179 | if (!task) { | |
@@ -194,7 +194,7 @@ static void ares_sockstate_cb(void* data, | |||
| 194 | 194 | return; | |
| 195 | 195 | } | |
| 196 | 196 | ||
| 197 | - RB_INSERT(ares_task_list, env->cares_task_list(), task); | ||
| 197 | + RB_INSERT(node_ares_task_list, env->cares_task_list(), task); | ||
| 198 | 198 | } | |
| 199 | 199 | ||
| 200 | 200 | /* This should never fail. If it fails anyway, the query will eventually */ | |
@@ -210,7 +210,7 @@ static void ares_sockstate_cb(void* data, | |||
| 210 | 210 | CHECK(task && | |
| 211 | 211 | "When an ares socket is closed we should have a handle for it"); | |
| 212 | 212 | ||
| 213 | - RB_REMOVE(ares_task_list, env->cares_task_list(), task); | ||
| 213 | + RB_REMOVE(node_ares_task_list, env->cares_task_list(), task); | ||
| 214 | 214 | uv_close(reinterpret_cast<uv_handle_t*>(&task->poll_watcher), | |
| 215 | 215 | ares_poll_close_cb); | |
| 216 | 216 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -428,7 +428,7 @@ inline ares_channel* Environment::cares_channel_ptr() { | |||
| 428 | 428 | return &cares_channel_; | |
| 429 | 429 | } | |
| 430 | 430 | ||
| 431 | - inline ares_task_list* Environment::cares_task_list() { | ||
| 431 | + inline node_ares_task_list* Environment::cares_task_list() { | ||
| 432 | 432 | return &cares_task_list_; | |
| 433 | 433 | } | |
| 434 | 434 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -291,16 +291,14 @@ namespace node { | |||
| 291 | 291 | ||
| 292 | 292 | class Environment; | |
| 293 | 293 | ||
| 294 | - // TODO(bnoordhuis) Rename struct, the ares_ prefix implies it's part | ||
| 295 | - // of the c-ares API while the _t suffix implies it's a typedef. | ||
| 296 | - struct ares_task_t { | ||
| 294 | + struct node_ares_task { | ||
| 297 | 295 | Environment* env; | |
| 298 | 296 | ares_socket_t sock; | |
| 299 | 297 | uv_poll_t poll_watcher; | |
| 300 | - RB_ENTRY(ares_task_t) node; | ||
| 298 | + RB_ENTRY(node_ares_task) node; | ||
| 301 | 299 | }; | |
| 302 | 300 | ||
| 303 | - RB_HEAD(ares_task_list, ares_task_t); | ||
| 301 | + RB_HEAD(node_ares_task_list, node_ares_task); | ||
| 304 | 302 | ||
| 305 | 303 | class Environment { | |
| 306 | 304 | public: | |
@@ -472,7 +470,7 @@ class Environment { | |||
| 472 | 470 | inline uv_timer_t* cares_timer_handle(); | |
| 473 | 471 | inline ares_channel cares_channel(); | |
| 474 | 472 | inline ares_channel* cares_channel_ptr(); | |
| 475 | - inline ares_task_list* cares_task_list(); | ||
| 473 | + inline node_ares_task_list* cares_task_list(); | ||
| 476 | 474 | ||
| 477 | 475 | inline bool using_domains() const; | |
| 478 | 476 | inline void set_using_domains(bool value); | |
@@ -588,7 +586,7 @@ class Environment { | |||
| 588 | 586 | const uint64_t timer_base_; | |
| 589 | 587 | uv_timer_t cares_timer_handle_; | |
| 590 | 588 | ares_channel cares_channel_; | |
| 591 | - ares_task_list cares_task_list_; | ||
| 589 | + node_ares_task_list cares_task_list_; | ||
| 592 | 590 | bool using_domains_; | |
| 593 | 591 | bool printed_error_; | |
| 594 | 592 | bool trace_sync_io_; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments