mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-01-02 23:47:07 -05:00
release timer faster after ctx finish
This commit is contained in:
parent
74b2734cb8
commit
aea71c2aa8
@ -24,12 +24,16 @@ func (t *realActivityTimer) Update() {
|
||||
}
|
||||
|
||||
func (t *realActivityTimer) run() {
|
||||
ticker := time.NewTicker(t.timeout)
|
||||
defer ticker.Stop()
|
||||
|
||||
for {
|
||||
select {
|
||||
case <-time.After(t.timeout):
|
||||
case <-ticker.C:
|
||||
case <-t.ctx.Done():
|
||||
return
|
||||
}
|
||||
|
||||
select {
|
||||
case <-t.updated:
|
||||
// Updated keep waiting.
|
||||
@ -37,7 +41,6 @@ func (t *realActivityTimer) run() {
|
||||
t.cancel()
|
||||
return
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user