1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2026-04-18 11:39:11 -04:00

use stream instead of raw chan

This commit is contained in:
v2ray
2016-04-18 18:44:10 +02:00
parent 42b8dbe871
commit 7407c8d561
25 changed files with 217 additions and 188 deletions

View File

@@ -154,13 +154,14 @@ func (this *HttpProxyServer) transport(input io.Reader, output io.Writer, ray ra
defer wg.Wait()
go func() {
v2io.RawReaderToChan(ray.InboundInput(), input)
close(ray.InboundInput())
v2io.Pipe(v2io.NewAdaptiveReader(input), ray.InboundInput())
ray.InboundInput().Close()
wg.Done()
}()
go func() {
v2io.ChanToRawWriter(output, ray.InboundOutput())
v2io.Pipe(ray.InboundOutput(), v2io.NewAdaptiveWriter(output))
ray.InboundOutput().Release()
wg.Done()
}()
}
@@ -222,7 +223,7 @@ func (this *HttpProxyServer) handlePlainHTTP(request *http.Request, dest v2net.D
packet := v2net.NewPacket(dest, requestBuffer, true)
ray := this.packetDispatcher.DispatchToOutbound(packet)
defer close(ray.InboundInput())
defer ray.InboundInput().Close()
var wg sync.WaitGroup
wg.Add(1)