From 6a7a8ec6179cb15504aaa8703dc66ddc76cb24c2 Mon Sep 17 00:00:00 2001 From: Oskar Mansfeld Date: Sat, 15 Feb 2025 10:50:36 +0000 Subject: [PATCH] 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 --- netwerk/dns/nsHostResolver.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/netwerk/dns/nsHostResolver.cpp b/netwerk/dns/nsHostResolver.cpp index 8196ce132354..0f57337dd62f 100644 --- a/netwerk/dns/nsHostResolver.cpp +++ b/netwerk/dns/nsHostResolver.cpp @@ -1318,13 +1318,8 @@ void nsHostResolver::PrepareRecordExpirationAddrRecord( unsigned int lifetime = StaticPrefs::network_dnsCacheExpiration(); unsigned int grace = StaticPrefs::network_dnsCacheExpirationGracePeriod(); - unsigned int ttl = StaticPrefs::network_dnsCacheExpiration(); - if (StaticPrefs::network_dns_get_ttl() || rec->addr_info->IsTRR()) { - if (rec->addr_info && rec->addr_info->TTL() != AddrInfo::NO_TTL_DATA) { - ttl = rec->addr_info->TTL(); - } - lifetime = ttl; - grace = 0; + if (rec->addr_info && rec->addr_info->TTL() != AddrInfo::NO_TTL_DATA) { + lifetime = rec->addr_info->TTL(); } rec->SetExpiration(TimeStamp::NowLoRes(), lifetime, grace);