From 2ff229e9d9634955037e92dfda063686963ad2be Mon Sep 17 00:00:00 2001 From: fumiama Date: Mon, 3 Jan 2022 01:00:35 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9A=B0=EF=B8=8F=20=20=E7=AE=80=E5=8C=96=20ge?= =?UTF-8?q?tdata?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- control/rule.go | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/control/rule.go b/control/rule.go index 9c99164b..c5749862 100644 --- a/control/rule.go +++ b/control/rule.go @@ -211,20 +211,11 @@ func (m *Control) GetData(gid int64) int64 { var c grpcfg var err error log.Debugln("[control] IsEnabledIn recv gid =", gid) - if gid != 0 { - m.RLock() - err = db.Find(m.service, &c, "WHERE gid = "+strconv.FormatInt(gid, 10)) - m.RUnlock() - if err == nil && gid == c.GroupID { - log.Debugf("[control] plugin %s of grp %d : %x", m.service, c.GroupID, c.Disable>>1) - return c.Disable >> 1 - } - } m.RLock() - err = db.Find(m.service, &c, "WHERE gid = 0") + err = db.Find(m.service, &c, "WHERE gid = "+strconv.FormatInt(gid, 10)) m.RUnlock() - if err == nil && c.GroupID == 0 { - log.Debugf("[control] plugin %s of all : %x", m.service, c.Disable>>1) + if err == nil && gid == c.GroupID { + log.Debugf("[control] plugin %s of grp %d : %x", m.service, c.GroupID, c.Disable>>1) return c.Disable >> 1 } return 0