From 7fcc999c2bfe7ba1e853d30810e123362f4b7f07 Mon Sep 17 00:00:00 2001 From: Alejandro Lopez Date: Fri, 30 Jun 2023 10:08:36 +0300 Subject: [PATCH] [#92] Embed policer's objectsInWork mutex Signed-off-by: Alejandro Lopez --- pkg/services/policer/policer.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pkg/services/policer/policer.go b/pkg/services/policer/policer.go index 4be13e0d8..d49ad4632 100644 --- a/pkg/services/policer/policer.go +++ b/pkg/services/policer/policer.go @@ -11,28 +11,28 @@ import ( ) type objectsInWork struct { - m sync.RWMutex + sync.RWMutex objs map[oid.Address]struct{} } func (oiw *objectsInWork) inWork(addr oid.Address) bool { - oiw.m.RLock() + oiw.RLock() _, ok := oiw.objs[addr] - oiw.m.RUnlock() + oiw.RUnlock() return ok } func (oiw *objectsInWork) remove(addr oid.Address) { - oiw.m.Lock() + oiw.Lock() delete(oiw.objs, addr) - oiw.m.Unlock() + oiw.Unlock() } func (oiw *objectsInWork) add(addr oid.Address) { - oiw.m.Lock() + oiw.Lock() oiw.objs[addr] = struct{}{} - oiw.m.Unlock() + oiw.Unlock() } // Policer represents the utility that verifies