func (v *Server) transport(input io.Reader, output io.Writer, ray ray.InboundRay) { var wg sync.WaitGroup wg.Add(2) defer wg.Wait() go func() { v2reader := buf.NewReader(input) defer v2reader.Release() if err := buf.PipeUntilEOF(v2reader, ray.InboundInput()); err != nil { log.Info("HTTP: Failed to transport all TCP request: ", err) } ray.InboundInput().Close() wg.Done() }() go func() { v2writer := buf.NewWriter(output) defer v2writer.Release() if err := buf.PipeUntilEOF(ray.InboundOutput(), v2writer); err != nil { log.Info("HTTP: Failed to transport all TCP response: ", err) } ray.InboundOutput().Release() wg.Done() }() }
func (this *Server) transport(input io.Reader, output io.Writer, ray ray.InboundRay) { var wg sync.WaitGroup wg.Add(2) defer wg.Wait() go func() { v2reader := v2io.NewAdaptiveReader(input) defer v2reader.Release() v2io.Pipe(v2reader, ray.InboundInput()) ray.InboundInput().Close() wg.Done() }() go func() { v2writer := v2io.NewAdaptiveWriter(output) defer v2writer.Release() v2io.Pipe(ray.InboundOutput(), v2writer) ray.InboundOutput().Release() wg.Done() }() }