release all adaptive readers and writers

This commit is contained in:
v2ray
2016-04-18 19:01:24 +02:00
parent 7768674df8
commit 44bf412dfc
7 changed files with 52 additions and 13 deletions

View File

@@ -42,13 +42,19 @@ func (this *InboundConnectionHandler) Communicate(packet v2net.Packet) error {
writeFinish.Lock()
go func() {
v2io.Pipe(v2io.NewAdaptiveReader(this.ConnInput), input)
v2reader := v2io.NewAdaptiveReader(this.ConnInput)
defer v2reader.Release()
v2io.Pipe(v2reader, input)
input.Close()
readFinish.Unlock()
}()
go func() {
v2io.Pipe(output, v2io.NewAdaptiveWriter(this.ConnOutput))
v2writer := v2io.NewAdaptiveWriter(this.ConnOutput)
defer v2writer.Release()
v2io.Pipe(output, v2writer)
output.Release()
writeFinish.Unlock()
}()