mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-01-02 15:36:41 -05:00
remove unnecessary id cache
This commit is contained in:
parent
ee5bc8133a
commit
deb7dab8f3
@ -47,7 +47,7 @@ func NewTimedUserValidator(hasher protocol.IDHash) protocol.UserValidator {
|
|||||||
users: make([]*user, 0, 16),
|
users: make([]*user, 0, 16),
|
||||||
userHash: make(map[[16]byte]indexTimePair, 1024),
|
userHash: make(map[[16]byte]indexTimePair, 1024),
|
||||||
hasher: hasher,
|
hasher: hasher,
|
||||||
baseTime: protocol.Timestamp(time.Now().Unix() - cacheDurationSec*3),
|
baseTime: protocol.Timestamp(time.Now().Unix() - cacheDurationSec*2),
|
||||||
}
|
}
|
||||||
tuv.task = &signal.PeriodicTask{
|
tuv.task = &signal.PeriodicTask{
|
||||||
Interval: updateInterval,
|
Interval: updateInterval,
|
||||||
@ -105,7 +105,7 @@ func (v *TimedUserValidator) updateUserHash() {
|
|||||||
v.generateNewHashes(nowSec, user)
|
v.generateNewHashes(nowSec, user)
|
||||||
}
|
}
|
||||||
|
|
||||||
expire := protocol.Timestamp(now.Unix() - cacheDurationSec*3)
|
expire := protocol.Timestamp(now.Unix() - cacheDurationSec)
|
||||||
if expire > v.baseTime {
|
if expire > v.baseTime {
|
||||||
v.removeExpiredHashes(uint32(expire - v.baseTime))
|
v.removeExpiredHashes(uint32(expire - v.baseTime))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user