summaryrefslogtreecommitdiff
path: root/src/resolve/resolved-dns-scope.h
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-11-26 23:51:59 +0100
committerLennart Poettering <lennart@poettering.net>2015-11-27 00:03:39 +0100
commitf9ebb22ab4758bc5bbaaf8eeead74b5b4f81d5c3 (patch)
tree87eed36260c23641f9bb1bb654dcacaa407485ce /src/resolve/resolved-dns-scope.h
parentc3bc53e62459d7e566ffffeade41cd82bc6754f5 (diff)
resolved: handle properly if there are multiple transactions for the same key per scope
When the zone probing code looks for a transaction to reuse it will refuse to look at transactions that have been answered from cache or the zone itself, but insist on the network. This has the effect that there might be multiple transactions around for the same key on the same scope. Previously we'd track all transactions in a hashmap, indexed by the key, which implied that there would be only one transaction per key, per scope. With this change the hashmap will only store the most recent transaction per key, and a linked list will be used to track all transactions per scope, allowing multiple per-key per-scope. Note that the linked list fields for this actually already existed in the DnsTransaction structure, but were previously unused.
Diffstat (limited to 'src/resolve/resolved-dns-scope.h')
-rw-r--r--src/resolve/resolved-dns-scope.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/resolve/resolved-dns-scope.h b/src/resolve/resolved-dns-scope.h
index 32e6961757..7876410b7d 100644
--- a/src/resolve/resolved-dns-scope.h
+++ b/src/resolve/resolved-dns-scope.h
@@ -58,9 +58,19 @@ struct DnsScope {
usec_t resend_timeout;
usec_t max_rtt;
- Hashmap *transactions;
LIST_HEAD(DnsQueryCandidate, query_candidates);
+ /* Note that we keep track of ongoing transactions in two
+ * ways: once in a hashmap, indexed by the rr key, and once in
+ * a linked list. We use the hashmap to quickly find
+ * transactions we can reuse for a key. But note that there
+ * might be multiple transactions for the same key (because
+ * the zone probing can't reuse a transaction answered from
+ * the zone or the cache), and the hashmap only tracks the
+ * most recent entry. */
+ Hashmap *transactions_by_key;
+ LIST_HEAD(DnsTransaction, transactions);
+
LIST_FIELDS(DnsScope, scopes);
};