You've already forked v2ray-core
unified task package
This commit is contained in:
@@ -5,10 +5,11 @@ import (
|
||||
"io"
|
||||
"time"
|
||||
|
||||
"v2ray.com/core/common/task"
|
||||
|
||||
"v2ray.com/core"
|
||||
"v2ray.com/core/common"
|
||||
"v2ray.com/core/common/buf"
|
||||
"v2ray.com/core/common/functions"
|
||||
"v2ray.com/core/common/log"
|
||||
"v2ray.com/core/common/net"
|
||||
"v2ray.com/core/common/protocol"
|
||||
@@ -160,7 +161,8 @@ func (s *Server) transport(ctx context.Context, reader io.Reader, writer io.Writ
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := signal.ExecuteParallel(ctx, functions.OnSuccess(requestDone, functions.Close(link.Writer)), responseDone); err != nil {
|
||||
var requestDonePost = task.Single(requestDone, task.OnSuccess(task.Close(link.Writer)))
|
||||
if err := task.Run(task.WithContext(ctx), task.Parallel(requestDonePost, responseDone))(); err != nil {
|
||||
pipe.CloseError(link.Reader)
|
||||
pipe.CloseError(link.Writer)
|
||||
return newError("connection ends").Base(err)
|
||||
|
||||
Reference in New Issue
Block a user