1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-06-27 01:45:23 +00:00

accelerate one task execution

This commit is contained in:
Darien Raymond 2018-07-15 16:04:02 +02:00
parent dde06289bb
commit eafe580be4
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

View File

@ -20,6 +20,11 @@ func (c *executionContext) executeTask() error {
return nil
}
// Reuse current goroutine if we only have one task to run.
if len(c.tasks) == 1 && c.ctx == nil {
return c.tasks[0]()
}
ctx := context.Background()
if c.ctx != nil {