summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIdan Horowitz <idan.horowitz@gmail.com>2022-07-02 21:36:41 +0300
committerIdan Horowitz <idan.horowitz@gmail.com>2022-07-02 23:41:06 +0300
commit888d8e53a33ab87a00bc261a1bec5d95a308b322 (patch)
treeccda4e664d02ec8ceed18188db4d64c10e162f74
parentc8d1c263d665f3cf9fd9e034577f613ed593dd72 (diff)
downloadserenity-888d8e53a33ab87a00bc261a1bec5d95a308b322.zip
LookupServer: Try other available DNS nameservers on network errors
We were accidentally short-circuting DNS lookup on network errors when contacting the first DNS server, instead of trying the other available options.
-rw-r--r--Userland/Services/LookupServer/LookupServer.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/Userland/Services/LookupServer/LookupServer.cpp b/Userland/Services/LookupServer/LookupServer.cpp
index 5cea3bf57b..8421faad8b 100644
--- a/Userland/Services/LookupServer/LookupServer.cpp
+++ b/Userland/Services/LookupServer/LookupServer.cpp
@@ -196,7 +196,10 @@ ErrorOr<Vector<Answer>> LookupServer::lookup(Name const& name, RecordType record
int retries = 3;
Vector<Answer> upstream_answers;
do {
- upstream_answers = TRY(lookup(name, nameserver, did_get_response, record_type));
+ auto upstream_answers_or_error = lookup(name, nameserver, did_get_response, record_type);
+ if (upstream_answers_or_error.is_error())
+ continue;
+ upstream_answers = upstream_answers_or_error.release_value();
if (did_get_response)
break;
} while (--retries);