mirror of
https://github.com/Li4n0/revsuit.git
synced 2026-09-22 06:40:43 +08:00
+4
-4
@@ -48,7 +48,7 @@ func (s *Server) getRules() []*Rule {
|
||||
return s.rules
|
||||
}
|
||||
|
||||
func (s *Server) updateRules() error {
|
||||
func (s *Server) UpdateRules() error {
|
||||
db := database.DB.Model(new(Rule))
|
||||
defer s.rulesLock.Unlock()
|
||||
s.rulesLock.Lock()
|
||||
@@ -105,11 +105,11 @@ func (s *Server) ConnectionClosed(c *vmysql.Conn) {
|
||||
var clientName, clientOS, flag, flagGroup string
|
||||
|
||||
user := c.User
|
||||
schema := c.SchemaName
|
||||
supportLoadLocalData := c.SupportLoadDataLocal
|
||||
|
||||
cr, ok := s.connRulePool.Load(c.ConnectionID)
|
||||
if !ok {
|
||||
log.Warn("MySQL Connection rule(%d) not match flag", c.ConnectionID)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@ func (s *Server) ConnectionClosed(c *vmysql.Conn) {
|
||||
}
|
||||
}
|
||||
|
||||
r, err := newRecord(_rule, flag, user, clientName, clientOS, ip, qqwry.Area(ip), supportLoadLocalData, files)
|
||||
r, err := newRecord(_rule, flag, user, schema, clientName, clientOS, ip, qqwry.Area(ip), supportLoadLocalData, files)
|
||||
if err != nil {
|
||||
log.Warn("MySQL record[rule_id: %s] created failed: %s", _rule.Name, err)
|
||||
return
|
||||
@@ -288,7 +288,7 @@ func (s *Server) Run() {
|
||||
s.Enable = false
|
||||
s.livingLock.Unlock()
|
||||
}()
|
||||
if err := s.updateRules(); err != nil {
|
||||
if err := s.UpdateRules(); err != nil {
|
||||
log.Error(err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user