mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-12-21 17:46:58 -05:00
agreesively close rays
This commit is contained in:
parent
8d1f06ebaf
commit
67db5830be
@ -68,6 +68,7 @@ func (this *FreedomConnection) Dispatch(destination v2net.Destination, payload *
|
|||||||
defer v2reader.Release()
|
defer v2reader.Release()
|
||||||
|
|
||||||
v2io.Pipe(v2reader, output)
|
v2io.Pipe(v2reader, output)
|
||||||
|
ray.OutboundOutput().Close()
|
||||||
}()
|
}()
|
||||||
|
|
||||||
writeMutex.Lock()
|
writeMutex.Lock()
|
||||||
|
@ -205,6 +205,7 @@ func (this *Shadowsocks) handleConnection(conn *hub.Connection) {
|
|||||||
log.Info("Shadowsocks: Tunnelling request to ", dest)
|
log.Info("Shadowsocks: Tunnelling request to ", dest)
|
||||||
|
|
||||||
ray := this.packetDispatcher.DispatchToOutbound(dest)
|
ray := this.packetDispatcher.DispatchToOutbound(dest)
|
||||||
|
defer ray.InboundOutput().Release()
|
||||||
|
|
||||||
var writeFinish sync.Mutex
|
var writeFinish sync.Mutex
|
||||||
writeFinish.Lock()
|
writeFinish.Lock()
|
||||||
@ -227,7 +228,6 @@ func (this *Shadowsocks) handleConnection(conn *hub.Connection) {
|
|||||||
v2writer := v2io.NewAdaptiveWriter(writer)
|
v2writer := v2io.NewAdaptiveWriter(writer)
|
||||||
|
|
||||||
v2io.Pipe(ray.InboundOutput(), v2writer)
|
v2io.Pipe(ray.InboundOutput(), v2writer)
|
||||||
ray.InboundOutput().Release()
|
|
||||||
writer.Release()
|
writer.Release()
|
||||||
v2writer.Release()
|
v2writer.Release()
|
||||||
}
|
}
|
||||||
|
@ -139,6 +139,9 @@ func (this *VMessInboundHandler) HandleConnection(connection *hub.Connection) {
|
|||||||
ray := this.packetDispatcher.DispatchToOutbound(request.Destination())
|
ray := this.packetDispatcher.DispatchToOutbound(request.Destination())
|
||||||
input := ray.InboundInput()
|
input := ray.InboundInput()
|
||||||
output := ray.InboundOutput()
|
output := ray.InboundOutput()
|
||||||
|
defer input.Close()
|
||||||
|
defer output.Release()
|
||||||
|
|
||||||
var readFinish, writeFinish sync.Mutex
|
var readFinish, writeFinish sync.Mutex
|
||||||
readFinish.Lock()
|
readFinish.Lock()
|
||||||
writeFinish.Lock()
|
writeFinish.Lock()
|
||||||
@ -189,7 +192,6 @@ func (this *VMessInboundHandler) HandleConnection(connection *hub.Connection) {
|
|||||||
if request.Option.IsChunkStream() {
|
if request.Option.IsChunkStream() {
|
||||||
writer.Write(alloc.NewSmallBuffer().Clear())
|
writer.Write(alloc.NewSmallBuffer().Clear())
|
||||||
}
|
}
|
||||||
output.Release()
|
|
||||||
writer.Release()
|
writer.Release()
|
||||||
finish.Unlock()
|
finish.Unlock()
|
||||||
}(&writeFinish)
|
}(&writeFinish)
|
||||||
|
Loading…
Reference in New Issue
Block a user