#include "alloc-util.h"
#include "dns-domain.h"
#include "dns-type.h"
+#include "event-util.h"
#include "hostname-util.h"
#include "local-addresses.h"
#include "resolved-dns-query.h"
assert(q);
- q->timeout_event_source = sd_event_source_disable_unref(q->timeout_event_source);
+ event_source_disable(q->timeout_event_source);
LIST_FOREACH(candidates_by_query, c, q->candidates)
dns_query_candidate_stop(c);
if (!q)
return NULL;
+ q->timeout_event_source = sd_event_source_disable_unref(q->timeout_event_source);
+
while (q->auxiliary_queries)
dns_query_free(q->auxiliary_queries);
LIST_FOREACH(scopes, s, q->manager->dns_scopes) {
DnsScopeMatch match;
- const char *name;
-
- name = dns_question_first_name(dns_query_question_for_protocol(q, s->protocol));
- if (!name)
- continue;
-
- match = dns_scope_good_domain(s, q->ifindex, q->flags, name);
- if (match < 0) {
- log_debug("Couldn't check if '%s' matches against scope, ignoring.", name);
- continue;
- }
+ match = dns_scope_good_domain(s, q);
+ assert(match >= 0);
if (match > found) { /* Does this match better? If so, remember how well it matched, and the first one
* that matches this well */
found = match;
LIST_FOREACH(scopes, s, first->scopes_next) {
DnsScopeMatch match;
- const char *name;
-
- name = dns_question_first_name(dns_query_question_for_protocol(q, s->protocol));
- if (!name)
- continue;
-
- match = dns_scope_good_domain(s, q->ifindex, q->flags, name);
- if (match < 0) {
- log_debug("Couldn't check if '%s' matches against scope, ignoring.", name);
- continue;
- }
+ match = dns_scope_good_domain(s, q);
+ assert(match >= 0);
if (match < found)
continue;
dns_query_reset_answer(q);
- r = sd_event_add_time_relative(
+ r = event_reset_time_relative(
q->manager->event,
&q->timeout_event_source,
clock_boottime_or_monotonic(),
SD_RESOLVED_QUERY_TIMEOUT_USEC,
- 0, on_query_timeout, q);
+ 0, on_query_timeout, q,
+ 0, "query-timeout", true);
if (r < 0)
goto fail;
- (void) sd_event_source_set_description(q->timeout_event_source, "query-timeout");
-
q->state = DNS_TRANSACTION_PENDING;
q->block_ready++;