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

update wait logic

This commit is contained in:
Darien Raymond 2017-01-31 14:15:34 +01:00
parent 23a8da215f
commit 52ee3ff79c
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

View File

@ -23,20 +23,17 @@ func (t *ActivityTimer) run() {
for {
select {
case <-time.After(t.timeout):
t.cancel()
return
case <-t.ctx.Done():
return
default:
select {
case <-time.After(t.timeout):
t.cancel()
return
case <-t.ctx.Done():
return
case <-t.updated:
}
}
select {
case <-t.updated:
// Updated keep waiting.
default:
t.cancel()
return
}
}
}