mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-12-30 05:56:54 -05:00
Remove call to UTC() which is not necessary.
This commit is contained in:
parent
d0ae47e2ce
commit
fdb41bbd50
@ -72,7 +72,7 @@ func (queue *TimedQueue) RemovedEntries() <-chan interface{} {
|
||||
|
||||
func (queue *TimedQueue) cleanup(tick <-chan time.Time) {
|
||||
for now := range tick {
|
||||
nowSec := now.UTC().Unix()
|
||||
nowSec := now.Unix()
|
||||
for {
|
||||
queue.access.RLock()
|
||||
queueLen := queue.queue.Len()
|
||||
|
@ -12,7 +12,7 @@ func TestTimedQueue(t *testing.T) {
|
||||
|
||||
removed := make(map[string]bool)
|
||||
|
||||
nowSec := time.Now().UTC().Unix()
|
||||
nowSec := time.Now().Unix()
|
||||
q := NewTimedQueue(2)
|
||||
|
||||
go func() {
|
||||
@ -51,7 +51,7 @@ func TestTimedQueue(t *testing.T) {
|
||||
<-tick
|
||||
assert.Bool(removed["Values"]).IsFalse()
|
||||
|
||||
q.Add("Value1", time.Now().UTC().Unix()+10)
|
||||
q.Add("Value1", time.Now().Unix()+10)
|
||||
|
||||
<-tick
|
||||
v1, ok = removed["Value1"]
|
||||
|
@ -63,10 +63,10 @@ func (us *TimedUserSet) generateNewHashes(lastSec, nowSec int64, idx int, id *co
|
||||
}
|
||||
|
||||
func (us *TimedUserSet) updateUserHash(tick <-chan time.Time) {
|
||||
lastSec := time.Now().UTC().Unix() - cacheDurationSec
|
||||
lastSec := time.Now().Unix() - cacheDurationSec
|
||||
|
||||
for now := range tick {
|
||||
nowSec := now.UTC().Unix() + cacheDurationSec
|
||||
nowSec := now.Unix() + cacheDurationSec
|
||||
for idx, id := range us.validUserIds {
|
||||
us.generateNewHashes(lastSec, nowSec, idx, id)
|
||||
}
|
||||
@ -79,7 +79,7 @@ func (us *TimedUserSet) AddUser(user config.User) error {
|
||||
idx := len(us.validUserIds)
|
||||
us.validUserIds = append(us.validUserIds, id)
|
||||
|
||||
nowSec := time.Now().UTC().Unix()
|
||||
nowSec := time.Now().Unix()
|
||||
lastSec := nowSec - cacheDurationSec
|
||||
us.generateNewHashes(lastSec, nowSec+cacheDurationSec, idx, id)
|
||||
|
||||
|
@ -166,7 +166,7 @@ func (request *VMessRequest) ToBytes(idHash user.CounterHash, randomRangeInt64 u
|
||||
buffer = alloc.NewSmallBuffer().Clear()
|
||||
}
|
||||
|
||||
counter := randomRangeInt64(time.Now().UTC().Unix(), 30)
|
||||
counter := randomRangeInt64(time.Now().Unix(), 30)
|
||||
hash := idHash.Hash(request.UserId.Bytes[:], counter)
|
||||
|
||||
buffer.Append(hash)
|
||||
|
Loading…
Reference in New Issue
Block a user