mirror of
https://github.com/daeuniverse/dae.git
synced 2025-02-23 21:23:25 +07:00
optimize: store dnsCache 17 more seconds
This commit is contained in:
parent
2105b5108b
commit
74676aca69
@ -142,13 +142,13 @@ func (c *ControlPlane) DnsRespHandler(data []byte) (newData []byte, err error) {
|
|||||||
cache, ok := c.dnsCache[cacheKey]
|
cache, ok := c.dnsCache[cacheKey]
|
||||||
if ok {
|
if ok {
|
||||||
c.mutex.Unlock()
|
c.mutex.Unlock()
|
||||||
cache.Deadline = time.Now().Add(time.Duration(ttl) * time.Second)
|
cache.Deadline = time.Now().Add(time.Duration(ttl)*time.Second + DnsNatTimeout)
|
||||||
cache.Answers = msg.Answers
|
cache.Answers = msg.Answers
|
||||||
} else {
|
} else {
|
||||||
cache = &dnsCache{
|
cache = &dnsCache{
|
||||||
DomainBitmap: c.MatchDomainBitmap(strings.TrimSuffix(fqdn, ".")),
|
DomainBitmap: c.MatchDomainBitmap(strings.TrimSuffix(fqdn, ".")),
|
||||||
Answers: msg.Answers,
|
Answers: msg.Answers,
|
||||||
Deadline: time.Now().Add(time.Duration(ttl) * time.Second),
|
Deadline: time.Now().Add(time.Duration(ttl)*time.Second + DnsNatTimeout),
|
||||||
}
|
}
|
||||||
c.dnsCache[cacheKey] = cache
|
c.dnsCache[cacheKey] = cache
|
||||||
c.mutex.Unlock()
|
c.mutex.Unlock()
|
||||||
|
Loading…
Reference in New Issue
Block a user