namesys: fix length of self resolve cache

License: MIT
Signed-off-by: 's avatarJakub Sztandera <kubuxu@protonmail.ch>
上级 9fe9d9eb
...@@ -125,6 +125,9 @@ func (ns *mpns) addToDHTCache(key ci.PrivKey, value path.Path, eol time.Time) { ...@@ -125,6 +125,9 @@ func (ns *mpns) addToDHTCache(key ci.PrivKey, value path.Path, eol time.Time) {
// should never happen, purely for sanity // should never happen, purely for sanity
log.Panicf("unexpected type %T as DHT resolver.", ns.resolvers["dht"]) log.Panicf("unexpected type %T as DHT resolver.", ns.resolvers["dht"])
} }
if time.Now().Add(DefaultResolverCacheTTL).Before(eol) {
eol = time.Now().Add(DefaultResolverCacheTTL)
}
rr.cache.Add(name.Pretty(), cacheEntry{ rr.cache.Add(name.Pretty(), cacheEntry{
val: value, val: value,
eol: eol, eol: eol,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论