diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2011-08-01 19:53:27 +0400 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2011-08-01 19:53:27 +0400 |
commit | 6378de7852d0b589f2271c7e6f7d43b8f7af7aa3 (patch) | |
tree | 07149bbe53fc2360b4c4838184d57702e496daf8 /src/dns.c | |
parent | 31ee07b15a645b31618bcaeab0ebee907a60fb70 (diff) | |
download | rspamd-6378de7852d0b589f2271c7e6f7d43b8f7af7aa3.tar.gz rspamd-6378de7852d0b589f2271c7e6f7d43b8f7af7aa3.zip |
Make DNS requests with unique id.
Diffstat (limited to 'src/dns.c')
-rw-r--r-- | src/dns.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -1150,6 +1150,7 @@ make_dns_request (struct rspamd_dns_resolver *resolver, struct in_addr addr; const gchar *name, *service, *proto; gint r; + struct dns_header *header; /* Check throttling */ if (resolver->throttling) { @@ -1233,6 +1234,12 @@ make_dns_request (struct rspamd_dns_resolver *resolver, evtimer_add (&req->timer_event, &req->tv); /* Add request to hash table */ + while (g_hash_table_lookup (resolver->requests, GUINT_TO_POINTER ((guint)req->id))) { + /* Check for unique id */ + header = (struct dns_header *)req->packet; + header->qid = dns_k_permutor_step (resolver->permutor); + req->id = header->qid; + } g_hash_table_insert (resolver->requests, GUINT_TO_POINTER ((guint)req->id), req); register_async_event (session, (event_finalizer_t)dns_fin_cb, req, FALSE); } |