mirror of
https://github.com/bjdgyc/anylink.git
synced 2025-08-08 14:29:42 +08:00
解决IpAuditMap在UDP下的fatal error: concurrent map read and map write
This commit is contained in:
@@ -149,14 +149,14 @@ func logAudit(cSess *sessdata.ConnSession, pl *sessdata.Payload) {
|
||||
nu := utils.NowSec().Unix()
|
||||
|
||||
// 判断已经存在,并且没有过期
|
||||
v, ok := cSess.IpAuditMap[s]
|
||||
if ok && nu-v < int64(base.Cfg.AuditInterval) {
|
||||
v, ok := cSess.IpAuditMap.Get(s)
|
||||
if ok && nu-v.(int64) < int64(base.Cfg.AuditInterval) {
|
||||
// 回收byte对象
|
||||
putByte51(b)
|
||||
return
|
||||
}
|
||||
|
||||
cSess.IpAuditMap[s] = nu
|
||||
cSess.IpAuditMap.Set(s, nu)
|
||||
|
||||
audit := dbdata.AccessAudit{
|
||||
Username: cSess.Sess.Username,
|
||||
|
Reference in New Issue
Block a user