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() input := ray.InboundInput()
output := ray.InboundOutput() output := ray.InboundOutput()
var inputFinish, outputFinish sync.Mutex defer input.Close()
inputFinish.Lock() defer output.Release()
outputFinish.Lock()
go func() { go func() {
v2reader := v2io.NewAdaptiveReader(reader) v2reader := v2io.NewAdaptiveReader(reader)
defer v2reader.Release() defer v2reader.Release()
v2io.Pipe(v2reader, input) v2io.Pipe(v2reader, input)
inputFinish.Unlock()
input.Close()
}() }()
go func() { v2writer := v2io.NewAdaptiveWriter(writer)
v2writer := v2io.NewAdaptiveWriter(writer) defer v2writer.Release()
defer v2writer.Release()
v2io.Pipe(output, v2writer) v2io.Pipe(output, v2writer)
outputFinish.Unlock() output.Release()
output.Release()
}()
outputFinish.Lock()
} }
type ServerFactory struct{} type ServerFactory struct{}

Loading…
Cancel
Save