1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2025-01-02 23:47:07 -05: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
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

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)
}