summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-12-26 14:18:11 +0100
committerLennart Poettering <lennart@poettering.net>2015-12-27 01:41:39 +0100
commitcbe4216dd1b76f26460c553aefeeebf29bce221c (patch)
treeb50f4b25ba0cc796d2a633766cc6da9113222d67 /src
parent598f44bd2c3b6143480358035643b98fcca353ed (diff)
resolved: remember explicitly whether we already tried a stream connection
On LLMNR we never want to retry stream connections (since local TCP connections should work, and we don't want to unnecessarily delay operation), explicitly remember whether we already tried one, instead of deriving this from a still stored stream object. This way, we can free the stream early, without forgetting that we tried it.
Diffstat (limited to 'src')
-rw-r--r--src/resolve/resolved-dns-transaction.c7
-rw-r--r--src/resolve/resolved-dns-transaction.h2
2 files changed, 5 insertions, 4 deletions
diff --git a/src/resolve/resolved-dns-transaction.c b/src/resolve/resolved-dns-transaction.c
index b0f40303d9..2eb1675c5b 100644
--- a/src/resolve/resolved-dns-transaction.c
+++ b/src/resolve/resolved-dns-transaction.c
@@ -421,6 +421,8 @@ static int dns_transaction_open_tcp(DnsTransaction *t) {
if (t->scope->link)
t->stream->ifindex = t->scope->link->ifindex;
+ t->tried_stream = true;
+
return 0;
}
@@ -826,13 +828,10 @@ static usec_t transaction_get_resend_timeout(DnsTransaction *t) {
}
static int dns_transaction_prepare(DnsTransaction *t, usec_t ts) {
- bool had_stream;
int r;
assert(t);
- had_stream = !!t->stream;
-
dns_transaction_stop(t);
if (t->n_attempts >= TRANSACTION_ATTEMPTS_MAX(t->scope->protocol)) {
@@ -840,7 +839,7 @@ static int dns_transaction_prepare(DnsTransaction *t, usec_t ts) {
return 0;
}
- if (t->scope->protocol == DNS_PROTOCOL_LLMNR && had_stream) {
+ if (t->scope->protocol == DNS_PROTOCOL_LLMNR && t->tried_stream) {
/* If we already tried via a stream, then we don't
* retry on LLMNR. See RFC 4795, Section 2.7. */
dns_transaction_complete(t, DNS_TRANSACTION_ATTEMPTS_MAX_REACHED);
diff --git a/src/resolve/resolved-dns-transaction.h b/src/resolve/resolved-dns-transaction.h
index eebb6ec631..a351a5043b 100644
--- a/src/resolve/resolved-dns-transaction.h
+++ b/src/resolve/resolved-dns-transaction.h
@@ -69,6 +69,8 @@ struct DnsTransaction {
uint16_t id;
+ bool tried_stream:1;
+
bool initial_jitter_scheduled:1;
bool initial_jitter_elapsed:1;