simplify ray stream

This commit is contained in:
Darien Raymond
2017-04-16 09:57:28 +02:00
parent d809973621
commit 2f565bfd5e
9 changed files with 120 additions and 168 deletions
+1 -2
View File
@@ -105,8 +105,7 @@ func (v *Client) Process(ctx context.Context, outboundRay ray.OutboundRay, diale
}
requestDone := signal.ExecuteAsync(func() error {
mergedInput := buf.NewMergingReader(outboundRay.OutboundInput())
if err := buf.PipeUntilEOF(timer, mergedInput, bodyWriter); err != nil {
if err := buf.PipeUntilEOF(timer, outboundRay.OutboundInput(), bodyWriter); err != nil {
return err
}
return nil
+2 -3
View File
@@ -160,8 +160,7 @@ func (s *Server) handleConnection(ctx context.Context, conn internet.Connection,
return newError("failed to write response").Base(err)
}
mergeReader := buf.NewMergingReader(ray.InboundOutput())
payload, err := mergeReader.Read()
payload, err := ray.InboundOutput().Read()
if err != nil {
return err
}
@@ -174,7 +173,7 @@ func (s *Server) handleConnection(ctx context.Context, conn internet.Connection,
return err
}
if err := buf.PipeUntilEOF(timer, mergeReader, responseWriter); err != nil {
if err := buf.PipeUntilEOF(timer, ray.InboundOutput(), responseWriter); err != nil {
return newError("failed to transport all TCP response").Base(err)
}