mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-25 19:56:30 +00:00
LibDNS: Check if cached lookup result is done before resolving
This commit is contained in:
parent
ec481aa08a
commit
1083046f65
Notes:
github-actions[bot]
2025-02-11 06:25:23 +00:00
Author: https://github.com/rmg-x
Commit: 1083046f65
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3523
Reviewed-by: https://github.com/ADKaster
Reviewed-by: https://github.com/alimpfard
1 changed files with 7 additions and 2 deletions
|
@ -99,6 +99,7 @@ public:
|
||||||
u16 id() { return m_id; }
|
u16 id() { return m_id; }
|
||||||
|
|
||||||
bool can_be_removed() const { return !m_valid && m_request_done; }
|
bool can_be_removed() const { return !m_valid && m_request_done; }
|
||||||
|
bool is_done() const { return m_request_done; }
|
||||||
Messages::DomainName const& name() const { return m_name; }
|
Messages::DomainName const& name() const { return m_name; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -320,8 +321,12 @@ public:
|
||||||
if (existing_promise)
|
if (existing_promise)
|
||||||
return existing_promise.release_nonnull();
|
return existing_promise.release_nonnull();
|
||||||
|
|
||||||
promise->resolve(*result);
|
// Something has gone wrong if there are no pending lookups but the result isn't done.
|
||||||
return promise;
|
// Continue on and hope that we eventually resolve or timeout in that case.
|
||||||
|
if (result->is_done()) {
|
||||||
|
promise->resolve(*result);
|
||||||
|
return promise;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Messages::Message query;
|
Messages::Message query;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue