Skip to content

Commit

Permalink
🐛 fix setdata&getdata
Browse files Browse the repository at this point in the history
  • Loading branch information
fumiama committed Jan 7, 2022
1 parent 7dd8152 commit c12c48d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions control/rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ func (m *Control) GetData(gid int64) int64 {
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)
log.Debugf("[control] plugin %s of grp %d : 0x%x", m.service, c.GroupID, c.Disable>>1)
return c.Disable >> 1
}
return 0
Expand All @@ -233,8 +233,9 @@ func (m *Control) SetData(groupID int64, data int64) error {
c.Disable = 1
}
}
c.Disable &= 1
c.Disable |= data << 1
log.Debugf("[control] set plugin %s of all : %x", m.service, data)
log.Debugf("[control] set plugin %s of grp %d : 0x%x", m.service, c.GroupID, data)
m.Lock()
err = db.Insert(m.service, &c)
m.Unlock()
Expand Down

0 comments on commit c12c48d

Please sign in to comment.