1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-30 05:56:54 -05:00
This commit is contained in:
V2Ray 2015-09-15 00:21:05 +02:00
parent f2734bd5a9
commit fa46e986ff
2 changed files with 1 additions and 9 deletions

View File

@ -19,7 +19,7 @@ V2Ray 是一个翻墙工具包,用于简化和复用其它翻墙工具,加
## 联系方式
公开的建议或意见请发 [Issue](https://github.com/v2ray/v2ray-core/issues),发 Issue 之前请先阅读 [Issue 指引](https://github.com/V2Ray/v2ray-core/blob/master/spec/issue.md)。
私下联系:admin@v2ray.com
私下联系:love@v2ray.com
## 合作机会
所有被标记为“[Help Wanted](https://github.com/v2ray/v2ray-core/labels/help%20wanted)”的 Issue 都接受 Pull Request如果你对本项目感兴趣并想做点贡献请挑选其中之一完善之不甚感激。

View File

@ -41,16 +41,11 @@ func (us *TimedUserSet) updateUserHash(tick <-chan time.Time) {
hash2Remove := make(chan hashEntry, cacheDurationSec*2*len(us.validUserIds))
lastSec2Remove := now.Unix()
log.Debug("Start updating")
for {
now := <-tick
nowSec := now.UTC().Unix()
remove2Sec := nowSec - cacheDurationSec
log.Debug("remove2Sec %d, to %d", lastSec2Remove, remove2Sec)
if remove2Sec > lastSec2Remove {
for lastSec2Remove+1 < remove2Sec {
entry := <-hash2Remove
@ -59,13 +54,10 @@ func (us *TimedUserSet) updateUserHash(tick <-chan time.Time) {
}
}
log.Debug("LastSec %d, to %d", lastSec, nowSec + updateIntervalSec)
for lastSec < nowSec + cacheDurationSec {
for idx, id := range us.validUserIds {
idHash := id.TimeHash(lastSec)
hash2Remove <- hashEntry{string(idHash), lastSec}
log.Debug("Hash: %v", idHash)
us.userHashes[string(idHash)] = idx
}
lastSec ++