1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2026-01-02 23:35:40 -05:00

discard bad connections

This commit is contained in:
v2ray
2016-06-01 22:09:34 +02:00
parent 4ec96efe84
commit 43f6998d31
3 changed files with 28 additions and 8 deletions

View File

@@ -169,7 +169,11 @@ func (this *VMessInboundHandler) HandleConnection(connection *hub.Connection) {
} else {
requestReader = v2io.NewAdaptiveReader(bodyReader)
}
v2io.Pipe(requestReader, input)
err := v2io.Pipe(requestReader, input)
if err != vmessio.ErrorStreamCompleted {
connection.SetReusable(false)
}
requestReader.Release()
input.Close()
readFinish.Unlock()
@@ -197,7 +201,11 @@ func (this *VMessInboundHandler) HandleConnection(connection *hub.Connection) {
writer.SetCached(false)
v2io.Pipe(output, v2writer)
err = v2io.Pipe(output, v2writer)
if err != vmessio.ErrorStreamCompleted {
connection.SetReusable(false)
}
output.Release()
if request.Option.IsChunkStream() {
v2writer.Write(alloc.NewSmallBuffer().Clear())