mirror of https://github.com/v2ray/v2ray-core
parent
0bc846f016
commit
8d1f06ebaf
|
@ -22,6 +22,7 @@ func (this *FreedomConnection) Dispatch(destination v2net.Destination, payload *
|
||||||
|
|
||||||
defer payload.Release()
|
defer payload.Release()
|
||||||
defer ray.OutboundInput().Release()
|
defer ray.OutboundInput().Release()
|
||||||
|
defer ray.OutboundOutput().Close()
|
||||||
|
|
||||||
var conn net.Conn
|
var conn net.Conn
|
||||||
err := retry.Timed(5, 100).On(func() error {
|
err := retry.Timed(5, 100).On(func() error {
|
||||||
|
@ -56,7 +57,6 @@ func (this *FreedomConnection) Dispatch(destination v2net.Destination, payload *
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
defer readMutex.Unlock()
|
defer readMutex.Unlock()
|
||||||
defer output.Close()
|
|
||||||
|
|
||||||
var reader io.Reader = conn
|
var reader io.Reader = conn
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,9 @@ type VMessOutboundHandler struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *VMessOutboundHandler) Dispatch(target v2net.Destination, payload *alloc.Buffer, ray ray.OutboundRay) error {
|
func (this *VMessOutboundHandler) Dispatch(target v2net.Destination, payload *alloc.Buffer, ray ray.OutboundRay) error {
|
||||||
|
defer ray.OutboundInput().Release()
|
||||||
|
defer ray.OutboundOutput().Close()
|
||||||
|
|
||||||
destination, vNextUser := this.receiverManager.PickReceiver()
|
destination, vNextUser := this.receiverManager.PickReceiver()
|
||||||
|
|
||||||
command := proto.RequestCommandTCP
|
command := proto.RequestCommandTCP
|
||||||
|
@ -41,9 +44,6 @@ func (this *VMessOutboundHandler) Dispatch(target v2net.Destination, payload *al
|
||||||
conn, err := dialer.Dial(destination)
|
conn, err := dialer.Dial(destination)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Failed to open ", destination, ": ", err)
|
log.Error("Failed to open ", destination, ": ", err)
|
||||||
if ray != nil {
|
|
||||||
ray.OutboundOutput().Close()
|
|
||||||
}
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
log.Info("VMessOut: Tunneling request to ", request.Address, " via ", destination)
|
log.Info("VMessOut: Tunneling request to ", request.Address, " via ", destination)
|
||||||
|
@ -64,8 +64,6 @@ func (this *VMessOutboundHandler) Dispatch(target v2net.Destination, payload *al
|
||||||
|
|
||||||
requestFinish.Lock()
|
requestFinish.Lock()
|
||||||
responseFinish.Lock()
|
responseFinish.Lock()
|
||||||
output.Close()
|
|
||||||
input.Release()
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue