diff options
author | Lennart Poettering <lennart@poettering.net> | 2020-08-16 13:43:51 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2020-08-26 16:47:57 +0200 |
commit | 65a01e82423dbffc45e897dabfd284419eb463c0 (patch) | |
tree | 783de0cb2337432593e3a85683db869a11c48641 /src/resolve/resolved-dns-query.c | |
parent | c9de4e0f5b87be8d0c447781f091ebeae0d0d5e4 (diff) | |
download | systemd-65a01e82423dbffc45e897dabfd284419eb463c0.tar.gz |
resolved: move query bus tracking to resolved-bus.c
It's strictly bus-specific, hence let's move this to resolved-bus.c like
the rest of the bus specific logic.
This is also in preparation for adding an alternative varlink transport,
which needs similar functionality, but varlink instead of bus-specific.
Diffstat (limited to 'src/resolve/resolved-dns-query.c')
-rw-r--r-- | src/resolve/resolved-dns-query.c | 37 |
1 files changed, 3 insertions, 34 deletions
diff --git a/src/resolve/resolved-dns-query.c b/src/resolve/resolved-dns-query.c index cd943ab843..ec57474351 100644 --- a/src/resolve/resolved-dns-query.c +++ b/src/resolve/resolved-dns-query.c @@ -473,14 +473,13 @@ int dns_query_make_auxiliary(DnsQuery *q, DnsQuery *auxiliary_for) { return 0; } -static void dns_query_complete(DnsQuery *q, DnsTransactionState state) { +void dns_query_complete(DnsQuery *q, DnsTransactionState state) { assert(q); assert(!DNS_TRANSACTION_IS_LIVE(state)); assert(DNS_TRANSACTION_IS_LIVE(q->state)); - /* Note that this call might invalidate the query. Callers - * should hence not attempt to access the query or transaction - * after calling this function. */ + /* Note that this call might invalidate the query. Callers should hence not attempt to access the + * query or transaction after calling this function. */ q->state = state; @@ -987,36 +986,6 @@ int dns_query_process_cname(DnsQuery *q) { return DNS_QUERY_RESTARTED; /* We restarted the query for a new cname */ } -static int on_bus_track(sd_bus_track *t, void *userdata) { - DnsQuery *q = userdata; - - assert(t); - assert(q); - - log_debug("Client of active query vanished, aborting query."); - dns_query_complete(q, DNS_TRANSACTION_ABORTED); - return 0; -} - -int dns_query_bus_track(DnsQuery *q, sd_bus_message *m) { - int r; - - assert(q); - assert(m); - - if (!q->bus_track) { - r = sd_bus_track_new(sd_bus_message_get_bus(m), &q->bus_track, on_bus_track, q); - if (r < 0) - return r; - } - - r = sd_bus_track_add_sender(q->bus_track, m); - if (r < 0) - return r; - - return 0; -} - DnsQuestion* dns_query_question_for_protocol(DnsQuery *q, DnsProtocol protocol) { assert(q); |