resolved: use reference counting for DnsQueryCandidate objects
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 29 Jan 2021 15:21:08 +0000 (16:21 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 2 Feb 2021 13:52:53 +0000 (14:52 +0100)
commitab9f7e1a51005f12d3bac83b86716d9d33048eb7
tree863a887fd697a584f9fa922f59467b2737a4f79d
parent91ba2eac4b6b463026b3a93e5a139923e8f2cfe4
resolved: use reference counting for DnsQueryCandidate objects

Follow-up for 4ea8b443de. The logic that manages DnsQueryCandidate is rather
complicated: a calls to dns_query_complete() that wants to destroy a
DnsQueryCandidate can be nested inside a deep chain of calls. Using reference
counts seems like the simplest approach.

DnsSearchDomain already uses reference counting.

This patch effectively brings dns_query_candidate_go() to the state before
4ea8b443de, but wraps the iteration over DnsQueryCandidate.transactions in
dns_query_candidate_ref+dns_query_candidate_unref.

(cherry picked from commit 0e0fd08fc832b8f42e567d722d388eba086da5ff)
src/resolve/resolved-dns-query.c
src/resolve/resolved-dns-query.h
src/resolve/resolved-dns-scope.c