mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-01-17 23:06:30 -05:00
prefer pointer over struct
This commit is contained in:
parent
131e6bf239
commit
c9750fa3ba
@ -43,7 +43,7 @@ type UserSet interface {
|
|||||||
|
|
||||||
type TimedUserSet struct {
|
type TimedUserSet struct {
|
||||||
validUsers []*proto.User
|
validUsers []*proto.User
|
||||||
userHash map[[16]byte]indexTimePair
|
userHash map[[16]byte]*indexTimePair
|
||||||
ids []*idEntry
|
ids []*idEntry
|
||||||
access sync.RWMutex
|
access sync.RWMutex
|
||||||
}
|
}
|
||||||
@ -56,7 +56,7 @@ type indexTimePair struct {
|
|||||||
func NewTimedUserSet() UserSet {
|
func NewTimedUserSet() UserSet {
|
||||||
tus := &TimedUserSet{
|
tus := &TimedUserSet{
|
||||||
validUsers: make([]*proto.User, 0, 16),
|
validUsers: make([]*proto.User, 0, 16),
|
||||||
userHash: make(map[[16]byte]indexTimePair, 512),
|
userHash: make(map[[16]byte]*indexTimePair, 512),
|
||||||
access: sync.RWMutex{},
|
access: sync.RWMutex{},
|
||||||
ids: make([]*idEntry, 0, 512),
|
ids: make([]*idEntry, 0, 512),
|
||||||
}
|
}
|
||||||
@ -78,7 +78,7 @@ func (us *TimedUserSet) generateNewHashes(nowSec Timestamp, idx int, entry *idEn
|
|||||||
idHash.Reset()
|
idHash.Reset()
|
||||||
|
|
||||||
us.access.Lock()
|
us.access.Lock()
|
||||||
us.userHash[hashValue] = indexTimePair{idx, entry.lastSec}
|
us.userHash[hashValue] = &indexTimePair{idx, entry.lastSec}
|
||||||
delete(us.userHash, hashValueRemoval)
|
delete(us.userHash, hashValueRemoval)
|
||||||
us.access.Unlock()
|
us.access.Unlock()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user