Bug 1947414 - grace period is now actually applied r=necko-reviewers,valentin

We set `grace=0` before for requests that had a TTL. Now that we want to experiment with bigger grace periods we don't zero the grace period at all anymore, no matter if there is a TTL or not.

Also cleaned up the (now unnessecary) nested if condition and removed double allocation of TTL data.

Differential Revision: https://phabricator.services.mozilla.com/D238033
This commit is contained in:
Oskar Mansfeld
2025-02-15 10:50:36 +00:00
parent 785a1b0b4c
commit 6a7a8ec617

View File

@@ -1318,13 +1318,8 @@ void nsHostResolver::PrepareRecordExpirationAddrRecord(
unsigned int lifetime = StaticPrefs::network_dnsCacheExpiration(); unsigned int lifetime = StaticPrefs::network_dnsCacheExpiration();
unsigned int grace = StaticPrefs::network_dnsCacheExpirationGracePeriod(); unsigned int grace = StaticPrefs::network_dnsCacheExpirationGracePeriod();
unsigned int ttl = StaticPrefs::network_dnsCacheExpiration(); if (rec->addr_info && rec->addr_info->TTL() != AddrInfo::NO_TTL_DATA) {
if (StaticPrefs::network_dns_get_ttl() || rec->addr_info->IsTRR()) { lifetime = rec->addr_info->TTL();
if (rec->addr_info && rec->addr_info->TTL() != AddrInfo::NO_TTL_DATA) {
ttl = rec->addr_info->TTL();
}
lifetime = ttl;
grace = 0;
} }
rec->SetExpiration(TimeStamp::NowLoRes(), lifetime, grace); rec->SetExpiration(TimeStamp::NowLoRes(), lifetime, grace);