1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2025-01-02 15:36:41 -05:00

fix conn reuse

This commit is contained in:
v2ray 2016-06-06 01:20:20 +02:00
parent e878973def
commit 83c7e8491c

View File

@ -136,6 +136,7 @@ func (this *VMessInboundHandler) HandleConnection(connection *hub.Connection) {
log.Access(connection.RemoteAddr(), "", log.AccessRejected, err) log.Access(connection.RemoteAddr(), "", log.AccessRejected, err)
log.Warning("VMessIn: Invalid request from ", connection.RemoteAddr(), ": ", err) log.Warning("VMessIn: Invalid request from ", connection.RemoteAddr(), ": ", err)
} }
connection.SetReusable(false)
return return
} }
log.Access(connection.RemoteAddr(), request.Destination(), log.AccessAccepted, "") log.Access(connection.RemoteAddr(), request.Destination(), log.AccessAccepted, "")
@ -198,7 +199,9 @@ func (this *VMessInboundHandler) HandleConnection(connection *hub.Connection) {
v2writer = vmessio.NewAuthChunkWriter(v2writer) v2writer = vmessio.NewAuthChunkWriter(v2writer)
} }
v2writer.Write(data) if err := v2writer.Write(data); err != nil {
connection.SetReusable(false)
}
writer.SetCached(false) writer.SetCached(false)
@ -209,7 +212,9 @@ func (this *VMessInboundHandler) HandleConnection(connection *hub.Connection) {
output.Release() output.Release()
if request.Option.Has(protocol.RequestOptionChunkStream) { if request.Option.Has(protocol.RequestOptionChunkStream) {
v2writer.Write(alloc.NewSmallBuffer().Clear()) if err := v2writer.Write(alloc.NewSmallBuffer().Clear()); err != nil {
connection.SetReusable(false)
}
} }
v2writer.Release() v2writer.Release()
} }