1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2026-06-21 18:29:55 -04:00

cancel immediately when timeout = 0

This commit is contained in:
Darien Raymond
2017-11-23 14:58:35 +01:00
parent 1226f3ce39
commit 0aa48e6c5a

View File

@@ -39,6 +39,11 @@ func (t *ActivityTimer) run() {
case <-t.ctx.Done():
return
case timeout := <-t.timeout:
if timeout == 0 {
t.cancel()
return
}
ticker.Stop()
ticker = time.NewTicker(timeout)
}