Fix and improve TTL handling

This commit is contained in:
Daniel
2020-07-20 16:40:47 +02:00
parent 813346e829
commit 8dea8e6c46
4 changed files with 15 additions and 6 deletions

View File

@@ -72,9 +72,12 @@ func (rrCache *RRCache) Clean(minExpires uint32) {
header.Ttl = 17
}
// TTL must be at least minExpires
if lowestTTL < minExpires {
// TTL range limits
switch {
case lowestTTL < minExpires:
lowestTTL = minExpires
case lowestTTL > maxTTL:
lowestTTL = maxTTL
}
// shorten caching