优化审计日志异步写入

This commit is contained in:
lanrenwo
2022-11-01 14:17:35 +08:00
parent 6fdc0e54d5
commit 890ff5753f
3 changed files with 55 additions and 87 deletions

View File

@@ -12,9 +12,7 @@ import (
"github.com/bjdgyc/anylink/base"
"github.com/bjdgyc/anylink/dbdata"
"github.com/bjdgyc/anylink/pkg/utils"
mapset "github.com/deckarep/golang-set"
"github.com/ivpusic/grpool"
atomic2 "go.uber.org/atomic"
)
@@ -52,8 +50,6 @@ type ConnSession struct {
PayloadIn chan *Payload
PayloadOutCstp chan *Payload // Cstp的数据
PayloadOutDtls chan *Payload // Dtls的数据
IpAuditMap utils.IMaps // 审计的ip数据
IpAuditPool *grpool.Pool // 审计的IP包解析池
// dSess *DtlsSession
dSess *atomic.Value
}
@@ -206,12 +202,6 @@ func (s *Session) NewConn() *ConnSession {
dSess: &atomic.Value{},
}
// ip 审计
if base.Cfg.AuditInterval >= 0 {
cSess.IpAuditMap = utils.NewMap("cmap", 0)
cSess.IpAuditPool = grpool.NewPool(1, 600)
}
dSess := &DtlsSession{
isActive: -1,
}
@@ -244,10 +234,6 @@ func (cs *ConnSession) Close() {
cs.Sess.LastLogin = time.Now()
cs.Sess.CSess = nil
if cs.IpAuditPool != nil {
cs.IpAuditPool.Release()
}
dSess := cs.GetDtlsSession()
if dSess != nil {
dSess.Close()