1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-09-27 22:36:12 -04:00

check closed again before scheduling another task

This commit is contained in:
Darien Raymond 2018-06-29 20:56:10 +02:00
parent 98e6254df8
commit 596d05bff5
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

View File

@ -42,12 +42,17 @@ func (t *Periodic) checkedExecute() error {
}
t.access.Lock()
defer t.access.Unlock()
if t.closed {
return nil
}
t.timer = time.AfterFunc(t.Interval, func() {
if err := t.checkedExecute(); err != nil && t.OnError != nil {
t.OnError(err)
}
})
t.access.Unlock()
return nil
}