fix: quic underlay packetConn not closed in xhttp h3 mode

This commit is contained in:
wwqgtxx committed 2026-04-11 00:32:29 +08:00
1 parent b0ea75bd21
commit db63ffbbf6
1 file changed
+8 -2
+8 -2
View File
@@ -600,7 +600,10 @@ func NewVless(option VlessOption) (*Vless, error) {
if err != nil {
return nil, err
}
quicConn, err := quic.DialEarly(ctx, packetConn, udpAddr, tlsConfig, cfg)
transport := quic.Transport{Conn: packetConn}
transport.SetCreatedConn(true) // auto close conn
transport.SetSingleUse(true) // auto close transport
quicConn, err := transport.DialEarly(ctx, udpAddr, tlsConfig, cfg)
if err != nil {
_ = packetConn.Close()
return nil, err
@@ -752,7 +755,10 @@ func NewVless(option VlessOption) (*Vless, error) {
if err != nil {
return nil, err
}
quicConn, err := quic.DialEarly(ctx, packetConn, udpAddr, tlsConfig, cfg)
transport := quic.Transport{Conn: packetConn}
transport.SetCreatedConn(true) // auto close conn
transport.SetSingleUse(true) // auto close transport
quicConn, err := transport.DialEarly(ctx, udpAddr, tlsConfig, cfg)
if err != nil {
_ = packetConn.Close()
return nil, err