mirror of
https://github.com/DNSCrypt/dnscrypt-proxy.git
synced 2025-01-17 02:46:54 +01:00
Properly round the TTL
This commit is contained in:
parent
5fedbe4c6e
commit
3bae61dbe1
@ -196,7 +196,7 @@ func updateTTL(msg *dns.Msg, expiration time.Time) {
|
|||||||
ttl := uint32(0)
|
ttl := uint32(0)
|
||||||
if until > 0 {
|
if until > 0 {
|
||||||
ttl = uint32(until / time.Second)
|
ttl = uint32(until / time.Second)
|
||||||
if until-time.Duration(ttl)*time.Second < until/2 {
|
if until-time.Duration(ttl)*time.Second >= time.Second/2 {
|
||||||
ttl += 1
|
ttl += 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user