mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-06-24 04:04:15 +00:00
common: fix task leak in timer (#4831)
signal包里面SetTimeout方法并发时可能会出现task close以后执行start导致泄露
This commit is contained in:
parent
38ed2cc387
commit
cb1afb33e6
1 changed files with 1 additions and 1 deletions
|
@ -67,9 +67,9 @@ func (t *ActivityTimer) SetTimeout(timeout time.Duration) {
|
||||||
t.checkTask.Close()
|
t.checkTask.Close()
|
||||||
}
|
}
|
||||||
t.checkTask = checkTask
|
t.checkTask = checkTask
|
||||||
t.Unlock()
|
|
||||||
t.Update()
|
t.Update()
|
||||||
common.Must(checkTask.Start())
|
common.Must(checkTask.Start())
|
||||||
|
t.Unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
func CancelAfterInactivity(ctx context.Context, cancel context.CancelFunc, timeout time.Duration) *ActivityTimer {
|
func CancelAfterInactivity(ctx context.Context, cancel context.CancelFunc, timeout time.Duration) *ActivityTimer {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue