mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-12-29 05:25:21 -05:00
close timer sooner
This commit is contained in:
@@ -21,14 +21,21 @@ func (t *ActivityTimer) UpdateActivity() {
|
||||
|
||||
func (t *ActivityTimer) run() {
|
||||
for {
|
||||
time.Sleep(t.timeout)
|
||||
select {
|
||||
case <-t.ctx.Done():
|
||||
return
|
||||
case <-t.updated:
|
||||
default:
|
||||
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:
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user