1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-22 01:57:12 -05:00

simpilify updateUserHash method

This commit is contained in:
v2ray 2016-06-04 19:59:23 +02:00
parent 798c870069
commit ea8f7e7506

View File

@ -50,7 +50,7 @@ func NewTimedUserValidator(hasher IDHash) UserValidator {
hasher: hasher,
cancel: signal.NewCloseSignal(),
}
go tus.updateUserHash(updateIntervalSec*time.Second, tus.cancel)
go tus.updateUserHash(updateIntervalSec * time.Second)
return tus
}
@ -88,7 +88,7 @@ func (this *TimedUserValidator) generateNewHashes(nowSec Timestamp, idx int, ent
}
}
func (this *TimedUserValidator) updateUserHash(interval time.Duration, cancel *signal.CancelSignal) {
func (this *TimedUserValidator) updateUserHash(interval time.Duration) {
L:
for {
select {
@ -97,11 +97,11 @@ L:
for _, entry := range this.ids {
this.generateNewHashes(nowSec, entry.userIdx, entry)
}
case <-cancel.WaitForCancel():
case <-this.cancel.WaitForCancel():
break L
}
}
cancel.Done()
this.cancel.Done()
}
func (this *TimedUserValidator) Add(user *User) error {