summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichal Schmidt <mschmidt@redhat.com>2014-08-22 13:56:51 +0200
committerMichal Schmidt <mschmidt@redhat.com>2014-10-23 17:38:02 +0200
commit1e43061b67336052b5b231840a38508a5397a363 (patch)
tree0e9ad3a74c5e1765f68c5348e2ec4e85159b6ce5 /src
parentc9fe4af70d2c884c1f95714a81ad6d1de31d5186 (diff)
resolve: make DnsScope::conflict_queue an OrderedHashmap
on_conflict_dispatch() uses hashmap_steal_first() and then does something non-trivial with it. It may care about the order.
Diffstat (limited to 'src')
-rw-r--r--src/resolve/resolved-dns-scope.c10
-rw-r--r--src/resolve/resolved-dns-scope.h2
2 files changed, 6 insertions, 6 deletions
diff --git a/src/resolve/resolved-dns-scope.c b/src/resolve/resolved-dns-scope.c
index 40d59922d1..1664b1328e 100644
--- a/src/resolve/resolved-dns-scope.c
+++ b/src/resolve/resolved-dns-scope.c
@@ -82,10 +82,10 @@ DnsScope* dns_scope_free(DnsScope *s) {
dns_transaction_free(t);
}
- while ((rr = hashmap_steal_first(s->conflict_queue)))
+ while ((rr = ordered_hashmap_steal_first(s->conflict_queue)))
dns_resource_record_unref(rr);
- hashmap_free(s->conflict_queue);
+ ordered_hashmap_free(s->conflict_queue);
sd_event_source_unref(s->conflict_event_source);
dns_cache_flush(&s->cache);
@@ -682,7 +682,7 @@ static int on_conflict_dispatch(sd_event_source *es, usec_t usec, void *userdata
_cleanup_(dns_resource_record_unrefp) DnsResourceRecord *rr = NULL;
_cleanup_(dns_packet_unrefp) DnsPacket *p = NULL;
- rr = hashmap_steal_first(scope->conflict_queue);
+ rr = ordered_hashmap_steal_first(scope->conflict_queue);
if (!rr)
break;
@@ -709,7 +709,7 @@ int dns_scope_notify_conflict(DnsScope *scope, DnsResourceRecord *rr) {
/* We don't send these queries immediately. Instead, we queue
* them, and send them after some jitter delay. */
- r = hashmap_ensure_allocated(&scope->conflict_queue, &dns_resource_key_hash_ops);
+ r = ordered_hashmap_ensure_allocated(&scope->conflict_queue, &dns_resource_key_hash_ops);
if (r < 0) {
log_oom();
return r;
@@ -718,7 +718,7 @@ int dns_scope_notify_conflict(DnsScope *scope, DnsResourceRecord *rr) {
/* We only place one RR per key in the conflict
* messages, not all of them. That should be enough to
* indicate where there might be a conflict */
- r = hashmap_put(scope->conflict_queue, rr->key, rr);
+ r = ordered_hashmap_put(scope->conflict_queue, rr->key, rr);
if (r == -EEXIST || r == 0)
return 0;
if (r < 0) {
diff --git a/src/resolve/resolved-dns-scope.h b/src/resolve/resolved-dns-scope.h
index a02230999b..f05648e5a5 100644
--- a/src/resolve/resolved-dns-scope.h
+++ b/src/resolve/resolved-dns-scope.h
@@ -55,7 +55,7 @@ struct DnsScope {
DnsCache cache;
DnsZone zone;
- Hashmap *conflict_queue;
+ OrderedHashmap *conflict_queue;
sd_event_source *conflict_event_source;
RateLimit ratelimit;