Finalmask: Fix panic when udpHop or xicmp fails; Restore udpHop's default interval (#6808)
https://github.com/XTLS/Xray-core/pull/6808#pullrequestreview-5324529175 --------- Co-authored-by: 风扇滑翔翼 <Fangliding.fshxy@outlook.com>
This commit is contained in:
1 parent
2953d44734
commit
7780db9bbe
2 files changed
+14
-6
No files matched your search
@@ -5,6 +5,7 @@ import (
|
||||
"fmt"
|
||||
"slices"
|
||||
|
||||
"github.com/xtls/xray-core/common"
|
||||
"github.com/xtls/xray-core/common/buf"
|
||||
"github.com/xtls/xray-core/common/errors"
|
||||
"github.com/xtls/xray-core/common/net"
|
||||
@@ -88,7 +89,7 @@ func (fm *FinalMask) DialTCP(ctx context.Context, dest net.Destination) (net.Con
|
||||
var newConn net.Conn
|
||||
newConn, err = fm.tcpMasks[i].WrapConnClient(conn, &dest, dialer)
|
||||
if err != nil {
|
||||
_ = conn.Close()
|
||||
common.CloseIfExists(conn)
|
||||
return nil, err
|
||||
}
|
||||
conn = newConn
|
||||
@@ -193,7 +194,7 @@ func (fm *FinalMask) DialUDP(ctx context.Context, dest net.Destination) (net.Con
|
||||
}
|
||||
newConn, err = fm.udpMasks[i].WrapPacketConnClient(conn, &dest, dialer)
|
||||
if err != nil {
|
||||
_ = conn.Close()
|
||||
common.CloseIfExists(conn)
|
||||
return nil, err
|
||||
}
|
||||
conn = newConn
|
||||
@@ -240,7 +241,7 @@ func (fm *FinalMask) ListenPacket(ctx context.Context, addr net.Addr) (net.Packe
|
||||
if _, ok := fm.udpMasks[i].(interface{ HeaderConn() }); ok {
|
||||
newConn, err = fm.udpMasks[i].WrapPacketConnServer(nil, nil, nil)
|
||||
if err != nil {
|
||||
_ = conn.Close()
|
||||
common.CloseIfExists(conn)
|
||||
return nil, err
|
||||
}
|
||||
sizes = append(sizes, newConn.(interface{ Size() int }).Size())
|
||||
@@ -253,7 +254,7 @@ func (fm *FinalMask) ListenPacket(ctx context.Context, addr net.Addr) (net.Packe
|
||||
}
|
||||
newConn, err = fm.udpMasks[i].WrapPacketConnServer(conn, addr, lc)
|
||||
if err != nil {
|
||||
_ = conn.Close()
|
||||
common.CloseIfExists(conn)
|
||||
return nil, err
|
||||
}
|
||||
conn = newConn
|
||||
|
||||
Reference in new issue
Block a user