From a4684d3bf5dd43b22b54be0ae138bd61547925e5 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Thu, 23 Sep 2021 19:10:40 +0200 Subject: [PATCH] Round TTLs --- dnscrypt-proxy/dnsutils.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dnscrypt-proxy/dnsutils.go b/dnscrypt-proxy/dnsutils.go index e936e5f5..db092380 100644 --- a/dnscrypt-proxy/dnsutils.go +++ b/dnscrypt-proxy/dnsutils.go @@ -196,6 +196,9 @@ func updateTTL(msg *dns.Msg, expiration time.Time) { ttl := uint32(0) if until > 0 { ttl = uint32(until / time.Second) + if until-time.Duration(ttl)*time.Second < until/2 { + ttl += 1 + } } for _, rr := range msg.Answer { rr.Header().Ttl = ttl