aboutsummaryrefslogtreecommitdiff
path: root/ares/ares_query.c
diff options
context:
space:
mode:
Diffstat (limited to 'ares/ares_query.c')
-rw-r--r--ares/ares_query.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/ares/ares_query.c b/ares/ares_query.c
index c5fc12449..c7c31edd9 100644
--- a/ares/ares_query.c
+++ b/ares/ares_query.c
@@ -68,15 +68,19 @@ void ares__rc4(rc4_key* key, unsigned char *buffer_ptr, int buffer_len)
static struct query* find_query_by_id(ares_channel channel, int id)
{
unsigned short qid;
- struct query* q;
+ struct list_node* list_head;
+ struct list_node* list_node;
DNS_HEADER_SET_QID(((unsigned char*)&qid), id);
/* Find the query corresponding to this packet. */
- for (q = channel->queries; q; q = q->next)
- {
- if (q->qid == qid)
+ list_head = &(channel->queries_by_qid[qid % ARES_QID_TABLE_SIZE]);
+ for (list_node = list_head->next; list_node != list_head;
+ list_node = list_node->next)
+ {
+ struct query *q = list_node->data;
+ if (q->qid == qid)
return q;
- }
+ }
return NULL;
}