修改 atomic 引用

This commit is contained in:
bjdgyc
2024-03-14 16:47:25 +08:00
parent 57a67ee030
commit 000b041578
10 changed files with 59 additions and 37 deletions

View File

@@ -13,7 +13,6 @@ import (
"github.com/bjdgyc/anylink/base"
"github.com/bjdgyc/anylink/dbdata"
mapset "github.com/deckarep/golang-set"
atomic2 "go.uber.org/atomic"
)
var (
@@ -41,15 +40,15 @@ type ConnSession struct {
CstpDpd int
Group *dbdata.Group
Limit *LimitRater
BandwidthUp atomic2.Uint32 // 使用上行带宽 Byte
BandwidthDown atomic2.Uint32 // 使用下行带宽 Byte
BandwidthUpPeriod atomic2.Uint32 // 前一周期的总量
BandwidthDownPeriod atomic2.Uint32
BandwidthUpAll atomic2.Uint64 // 使用上行带宽总量
BandwidthDownAll atomic2.Uint64 // 使用下行带宽总量
BandwidthUp atomic.Uint32 // 使用上行带宽 Byte
BandwidthDown atomic.Uint32 // 使用下行带宽 Byte
BandwidthUpPeriod atomic.Uint32 // 前一周期的总量
BandwidthDownPeriod atomic.Uint32
BandwidthUpAll atomic.Uint64 // 使用上行带宽总量
BandwidthDownAll atomic.Uint64 // 使用下行带宽总量
closeOnce sync.Once
CloseChan chan struct{}
LastDataTime atomic2.Time // 最后数据传输时间
LastDataTime atomic.Int64 // 最后数据传输时间
PayloadIn chan *Payload
PayloadOutCstp chan *Payload // Cstp的数据
PayloadOutDtls chan *Payload // Dtls的数据
@@ -220,7 +219,7 @@ func (s *Session) NewConn() *ConnSession {
PayloadOutDtls: make(chan *Payload, 64),
dSess: &atomic.Value{},
}
cSess.LastDataTime.Store(time.Now())
cSess.LastDataTime.Store(time.Now().Unix())
dSess := &DtlsSession{
isActive: -1,