mirror of
https://github.com/DNSCrypt/dnscrypt-proxy.git
synced 2025-01-17 02:46:54 +01:00
Round TTLs
This commit is contained in:
parent
34f0caaa34
commit
a4684d3bf5
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user