1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2025-01-04 16:37:12 -05:00

fix test break

This commit is contained in:
Darien Raymond 2017-04-07 22:29:31 +02:00
parent ade8453c0a
commit de0d0b3eb0
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

View File

@ -151,14 +151,15 @@ func (s *Server) handleConnection(ctx context.Context, conn internet.Connection,
return err return err
} }
requestDone := signal.ExecuteAsync(func() error { responseDone := signal.ExecuteAsync(func() error {
bufferedWriter := buf.NewBufferedWriter(conn) bufferedWriter := buf.NewBufferedWriter(conn)
responseWriter, err := WriteTCPResponse(request, bufferedWriter) responseWriter, err := WriteTCPResponse(request, bufferedWriter)
if err != nil { if err != nil {
return errors.New("failed to write response").Base(err).Path("Shadowsocks", "Server") return errors.New("failed to write response").Base(err).Path("Shadowsocks", "Server")
} }
payload, err := ray.InboundOutput().Read() mergeReader := buf.NewMergingReader(ray.InboundOutput())
payload, err := mergeReader.Read()
if err != nil { if err != nil {
return err return err
} }
@ -171,18 +172,17 @@ func (s *Server) handleConnection(ctx context.Context, conn internet.Connection,
return err return err
} }
if err := buf.PipeUntilEOF(timer, ray.InboundOutput(), responseWriter); err != nil { if err := buf.PipeUntilEOF(timer, mergeReader, responseWriter); err != nil {
return errors.New("failed to transport all TCP response").Base(err).Path("Shadowsocks", "Server") return errors.New("failed to transport all TCP response").Base(err).Path("Shadowsocks", "Server")
} }
return nil return nil
}) })
responseDone := signal.ExecuteAsync(func() error { requestDone := signal.ExecuteAsync(func() error {
defer ray.InboundInput().Close() defer ray.InboundInput().Close()
mergeReader := buf.NewMergingReader(bodyReader) if err := buf.PipeUntilEOF(timer, bodyReader, ray.InboundInput()); err != nil {
if err := buf.PipeUntilEOF(timer, mergeReader, ray.InboundInput()); err != nil {
return errors.New("failed to transport all TCP request").Base(err).Path("Shadowsocks", "Server") return errors.New("failed to transport all TCP request").Base(err).Path("Shadowsocks", "Server")
} }
return nil return nil