mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-06 17:48:37 +00:00
LookupServer: Track the receive timestamp for DNS answers
This commit is contained in:
parent
3304d675e1
commit
edb21e02ea
Notes:
sideshowbarker
2024-07-18 18:22:02 +09:00
Author: https://github.com/gunnarbeutner
Commit: edb21e02ea
Pull-request: https://github.com/SerenityOS/serenity/pull/6921
Reviewed-by: https://github.com/bugaevc
2 changed files with 4 additions and 6 deletions
|
@ -18,15 +18,12 @@ DNSAnswer::DNSAnswer(const DNSName& name, DNSRecordType type, DNSRecordClass cla
|
|||
, m_record_data(record_data)
|
||||
, m_mdns_cache_flush(mdns_cache_flush)
|
||||
{
|
||||
auto now = time(nullptr);
|
||||
m_expiration_time = now + m_ttl;
|
||||
if (m_expiration_time < now)
|
||||
m_expiration_time = 0;
|
||||
time(&m_received_time);
|
||||
}
|
||||
|
||||
bool DNSAnswer::has_expired() const
|
||||
{
|
||||
return time(nullptr) >= m_expiration_time;
|
||||
return time(nullptr) >= m_received_time + m_ttl;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue