simplify socks transport

pull/255/head
Darien Raymond 8 years ago
parent bd4ca7b37f
commit 9b72d3cbd7
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

@ -295,28 +295,21 @@ func (this *Server) transport(reader io.Reader, writer io.Writer, session *proxy
input := ray.InboundInput()
output := ray.InboundOutput()
var inputFinish, outputFinish sync.Mutex
inputFinish.Lock()
outputFinish.Lock()
defer input.Close()
defer output.Release()
go func() {
v2reader := v2io.NewAdaptiveReader(reader)
defer v2reader.Release()
v2io.Pipe(v2reader, input)
inputFinish.Unlock()
input.Close()
}()
go func() {
v2writer := v2io.NewAdaptiveWriter(writer)
defer v2writer.Release()
v2writer := v2io.NewAdaptiveWriter(writer)
defer v2writer.Release()
v2io.Pipe(output, v2writer)
outputFinish.Unlock()
output.Release()
}()
outputFinish.Lock()
v2io.Pipe(output, v2writer)
output.Release()
}
type ServerFactory struct{}

Loading…
Cancel
Save