1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2026-01-01 23:15:21 -05:00

unified task package

This commit is contained in:
Darien Raymond
2018-05-27 13:02:29 +02:00
parent 7fa4bb434b
commit 13f3c356ca
21 changed files with 252 additions and 66 deletions

View File

@@ -10,10 +10,10 @@ import (
"v2ray.com/core/common"
"v2ray.com/core/common/buf"
"v2ray.com/core/common/dice"
"v2ray.com/core/common/functions"
"v2ray.com/core/common/net"
"v2ray.com/core/common/retry"
"v2ray.com/core/common/signal"
"v2ray.com/core/common/task"
"v2ray.com/core/proxy"
"v2ray.com/core/transport/internet"
)
@@ -136,7 +136,7 @@ func (h *Handler) Process(ctx context.Context, link *core.Link, dialer proxy.Dia
return nil
}
if err := signal.ExecuteParallel(ctx, requestDone, functions.OnSuccess(responseDone, functions.Close(output))); err != nil {
if err := task.Run(task.WithContext(ctx), task.Parallel(requestDone, task.Single(responseDone, task.OnSuccess(task.Close(output)))))(); err != nil {
return newError("connection ends").Base(err)
}