XHTTP/3 client: Close the UDP socket when the QUIC dial fails (#7413)

https://github.com/XTLS/Xray-core/pull/7413#pullrequestreview-5975182281

---------

Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
Co-authored-by: 风扇滑翔翼 <Fangliding.fshxy@outlook.com>
This commit is contained in:
Shilmoon
2026-11-19 12:54:02 +00:00
committed by GitHub
co-authored by Claude Fable 5.2 风扇滑翔翼
parent febc082f03
commit 8e07407486
+3
View File
@@ -227,6 +227,9 @@ func createHTTPClient(dest net.Destination, streamSettings *internet.MemoryStrea
conn, err := tr.DialEarly(ctx, udpAddr, tlsCfg, cfg)
if err != nil {
// pktConn first: tr.Close() waits for the read from it to return, which with dialerProxy has no deadline
pktConn.Close()
tr.Close()
return nil, err
}
context.AfterFunc(conn.Context(), func() { tr.Close(); pktConn.Close() })