cmd/cli: add loop guard for LAN/PTR queries

This commit is contained in:
Cuong Manh Le
2023-12-05 20:24:12 +07:00
committed by Cuong Manh Le
parent af2c1c87e0
commit 0bb51aa71d
5 changed files with 87 additions and 1 deletions
+4
View File
@@ -66,6 +66,8 @@ type prog struct {
ciTable *clientinfo.Table
um *upstreamMonitor
router router.Router
ptrLoopGuard *loopGuard
lanLoopGuard *loopGuard
loopMu sync.Mutex
loop map[string]bool
@@ -236,6 +238,8 @@ func (p *prog) run(reload bool, reloadCh chan struct{}) {
}
p.onStartedDone = make(chan struct{})
p.loop = make(map[string]bool)
p.lanLoopGuard = newLoopGuard()
p.ptrLoopGuard = newLoopGuard()
if p.cfg.Service.CacheEnable {
cacher, err := dnscache.NewLRUCache(p.cfg.Service.CacheSize)
if err != nil {