mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 09:19:03 +00:00
LibDNS: Fix check for cache entries that can be removed
Co-authored-by: Ali Mohammad Pur <ali.mpfard@gmail.com>
This commit is contained in:
@@ -98,7 +98,7 @@ public:
|
|||||||
void set_id(u16 id) { m_id = id; }
|
void set_id(u16 id) { m_id = id; }
|
||||||
u16 id() { return m_id; }
|
u16 id() { return m_id; }
|
||||||
|
|
||||||
bool is_valid() const { return m_valid && m_request_done; }
|
bool can_be_removed() const { return !m_valid && m_request_done; }
|
||||||
Messages::DomainName const& name() const { return m_name; }
|
Messages::DomainName const& name() const { return m_name; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -518,7 +518,7 @@ private:
|
|||||||
HashTable<ByteString> to_remove;
|
HashTable<ByteString> to_remove;
|
||||||
for (auto& entry : cache) {
|
for (auto& entry : cache) {
|
||||||
entry.value->check_expiration();
|
entry.value->check_expiration();
|
||||||
if (!entry.value->is_valid())
|
if (entry.value->can_be_removed())
|
||||||
to_remove.set(entry.key);
|
to_remove.set(entry.key);
|
||||||
}
|
}
|
||||||
for (auto const& key : to_remove)
|
for (auto const& key : to_remove)
|
||||||
|
|||||||
Reference in New Issue
Block a user