diff options
author | Lennart Poettering <lennart@poettering.net> | 2014-07-23 00:57:25 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-07-23 02:00:40 +0200 |
commit | 7e8e0422aeb16f2a09a40546c61df753d10029b6 (patch) | |
tree | c5fd640ba84c1b3c92367aa4540e90c69c557a0b /src/resolve/resolved-dns-question.c | |
parent | faa133f3aa7a18f26563dc5d6b95898cb315c37a (diff) |
resolved: implement negative caching
Diffstat (limited to 'src/resolve/resolved-dns-question.c')
-rw-r--r-- | src/resolve/resolved-dns-question.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/resolve/resolved-dns-question.c b/src/resolve/resolved-dns-question.c index 026a67d7b3..056bd6eb64 100644 --- a/src/resolve/resolved-dns-question.c +++ b/src/resolve/resolved-dns-question.c @@ -65,9 +65,20 @@ DnsQuestion *dns_question_unref(DnsQuestion *q) { } int dns_question_add(DnsQuestion *q, DnsResourceKey *key) { + unsigned i; + int r; + assert(q); assert(key); + for (i = 0; i < q->n_keys; i++) { + r = dns_resource_key_equal(q->keys[i], key); + if (r < 0) + return r; + if (r > 0) + return 0; + } + if (q->n_keys >= q->n_allocated) return -ENOSPC; |