From 288d3e12c273ba7f0b2d994172ecb1882c536ea7 Mon Sep 17 00:00:00 2001 From: M09Ic Date: Thu, 1 Dec 2022 11:49:40 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=99map=E6=B7=BB=E5=8A=A0lock?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/pool.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/pool.go b/internal/pool.go index 07d51a2..bdef116 100644 --- a/internal/pool.go +++ b/internal/pool.go @@ -217,6 +217,7 @@ type Pool struct { base *pkg.Baseline index *pkg.Baseline baselines map[int]*pkg.Baseline + locker sync.Mutex analyzeDone bool genReq func(s string) (*ihttp.Request, error) check func() @@ -425,10 +426,9 @@ func (p *Pool) CompareWithExpr(exp *vm.Program, other *pkg.Baseline) bool { func (p *Pool) addFuzzyBaseline(bl *pkg.Baseline) { if _, ok := p.baselines[bl.Status]; !ok && IntsContains(FuzzyStatus, bl.Status) { bl.Collect() - var lock sync.Mutex - lock.Lock() + p.locker.Lock() p.baselines[bl.Status] = bl - lock.Unlock() + p.locker.Unlock() logs.Log.Importantf("[baseline.%dinit] %s", bl.Status, bl.String()) } }