1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-21 09:36:34 -05:00

remove unnecessary id cache

This commit is contained in:
Darien Raymond 2018-04-07 09:56:28 +02:00
parent ee5bc8133a
commit deb7dab8f3
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

View File

@ -47,7 +47,7 @@ func NewTimedUserValidator(hasher protocol.IDHash) protocol.UserValidator {
users: make([]*user, 0, 16),
userHash: make(map[[16]byte]indexTimePair, 1024),
hasher: hasher,
baseTime: protocol.Timestamp(time.Now().Unix() - cacheDurationSec*3),
baseTime: protocol.Timestamp(time.Now().Unix() - cacheDurationSec*2),
}
tuv.task = &signal.PeriodicTask{
Interval: updateInterval,
@ -105,7 +105,7 @@ func (v *TimedUserValidator) updateUserHash() {
v.generateNewHashes(nowSec, user)
}
expire := protocol.Timestamp(now.Unix() - cacheDurationSec*3)
expire := protocol.Timestamp(now.Unix() - cacheDurationSec)
if expire > v.baseTime {
v.removeExpiredHashes(uint32(expire - v.baseTime))
}