1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-22 01:57:12 -05:00

agressively close stream

This commit is contained in:
v2ray 2016-05-09 08:23:31 -07:00
parent 9b511fb071
commit ff210aa67f

View File

@ -151,8 +151,6 @@ func (this *VMessInboundHandler) HandleConnection(connection *hub.Connection) {
connReader.SetTimeOut(userSettings.PayloadReadTimeout) connReader.SetTimeOut(userSettings.PayloadReadTimeout)
reader.SetCached(false) reader.SetCached(false)
go func() { go func() {
defer input.Close()
defer readFinish.Unlock()
bodyReader := session.DecodeRequestBody(reader) bodyReader := session.DecodeRequestBody(reader)
var requestReader v2io.Reader var requestReader v2io.Reader
if request.Option.IsChunkStream() { if request.Option.IsChunkStream() {
@ -162,6 +160,8 @@ func (this *VMessInboundHandler) HandleConnection(connection *hub.Connection) {
} }
v2io.Pipe(requestReader, input) v2io.Pipe(requestReader, input)
requestReader.Release() requestReader.Release()
input.Close()
readFinish.Unlock()
}() }()
writer := v2io.NewBufferedWriter(connection) writer := v2io.NewBufferedWriter(connection)
@ -190,6 +190,7 @@ func (this *VMessInboundHandler) HandleConnection(connection *hub.Connection) {
writer = vmessio.NewAuthChunkWriter(writer) writer = vmessio.NewAuthChunkWriter(writer)
} }
v2io.Pipe(output, writer) v2io.Pipe(output, writer)
output.Release()
if request.Option.IsChunkStream() { if request.Option.IsChunkStream() {
writer.Write(alloc.NewSmallBuffer().Clear()) writer.Write(alloc.NewSmallBuffer().Clear())
} }