1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-21 17:46:58 -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)
reader.SetCached(false)
go func() {
defer input.Close()
defer readFinish.Unlock()
bodyReader := session.DecodeRequestBody(reader)
var requestReader v2io.Reader
if request.Option.IsChunkStream() {
@ -162,6 +160,8 @@ func (this *VMessInboundHandler) HandleConnection(connection *hub.Connection) {
}
v2io.Pipe(requestReader, input)
requestReader.Release()
input.Close()
readFinish.Unlock()
}()
writer := v2io.NewBufferedWriter(connection)
@ -190,6 +190,7 @@ func (this *VMessInboundHandler) HandleConnection(connection *hub.Connection) {
writer = vmessio.NewAuthChunkWriter(writer)
}
v2io.Pipe(output, writer)
output.Release()
if request.Option.IsChunkStream() {
writer.Write(alloc.NewSmallBuffer().Clear())
}