mirror of
https://gitclone.com/github.com/MetaCubeX/Clash.Meta
synced 2024-11-14 21:31:16 +08:00
fix: sing inbound should check needAdditionReadDeadline on udp too
This commit is contained in:
parent
15a8d7c473
commit
3b291d3fbf
@ -23,7 +23,7 @@ func NewDeadlineConn(conn net.Conn) ExtendedConn {
|
||||
return deadline.NewFallbackConn(conn)
|
||||
}
|
||||
|
||||
func NewDeadlinePacketConn(pc net.PacketConn) net.PacketConn {
|
||||
func NewDeadlinePacketConn(pc net.PacketConn) network.NetPacketConn {
|
||||
return deadline.NewFallbackPacketConn(bufio.NewPacketConn(pc))
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,7 @@ import (
|
||||
mux "github.com/sagernet/sing-mux"
|
||||
vmess "github.com/sagernet/sing-vmess"
|
||||
"github.com/sagernet/sing/common/buf"
|
||||
"github.com/sagernet/sing/common/bufio"
|
||||
"github.com/sagernet/sing/common/bufio/deadline"
|
||||
E "github.com/sagernet/sing/common/exceptions"
|
||||
M "github.com/sagernet/sing/common/metadata"
|
||||
@ -104,6 +105,9 @@ func (h *ListenerHandler) NewPacketConnection(ctx context.Context, conn network.
|
||||
additions = slices.Clone(additions)
|
||||
additions = append(additions, ctxAdditions...)
|
||||
}
|
||||
if deadline.NeedAdditionalReadDeadline(conn) {
|
||||
conn = N.NewDeadlinePacketConn(bufio.NewNetPacketConn(conn)) // conn from sing should check NeedAdditionalReadDeadline
|
||||
}
|
||||
defer func() { _ = conn.Close() }()
|
||||
mutex := sync.Mutex{}
|
||||
conn2 := conn // a new interface to set nil in defer
|
||||
|
Loading…
Reference in New Issue
Block a user