From 3fb39b479a350102ed0857b0cc2cb983a943ea75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=A5=A5=E8=B6=85?= Date: Sat, 3 Sep 2022 21:10:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96IP=E5=90=8D=E5=8D=95=E9=94=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/iplibrary/manager_ip_list.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/internal/iplibrary/manager_ip_list.go b/internal/iplibrary/manager_ip_list.go index 6901d7b..5438daf 100644 --- a/internal/iplibrary/manager_ip_list.go +++ b/internal/iplibrary/manager_ip_list.go @@ -187,7 +187,6 @@ func (this *IPListManager) FindList(listId int64) *IPList { } func (this *IPListManager) processItems(items []*pb.IPItem, fromRemote bool) { - this.locker.Lock() var changedLists = map[*IPList]zero.Zero{} for _, item := range items { var list *IPList @@ -207,11 +206,15 @@ func (this *IPListManager) processItems(items []*pb.IPItem, fromRemote bool) { list = GlobalWhiteIPList } } else { // 其他List + this.locker.Lock() list = this.listMap[item.ListId] + this.locker.Unlock() } if list == nil { list = NewIPList() + this.locker.Lock() this.listMap[item.ListId] = list + this.locker.Unlock() } changedLists[list] = zero.New() @@ -250,8 +253,6 @@ func (this *IPListManager) processItems(items []*pb.IPItem, fromRemote bool) { changedList.Sort() } - this.locker.Unlock() - if fromRemote { var latestVersion = items[len(items)-1].Version if latestVersion > this.version {