mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2026-04-22 16:17:16 +08:00
fix: quic underlay packetConn maybe not closed in masque
This commit is contained in:
@@ -268,9 +268,12 @@ func (w *Masque) run(ctx context.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
var quicConn *quic.Conn
|
||||
quicConn, err = quic.Dial(ctx, pc, udpAddr, w.tlsConfig, w.quicConfig)
|
||||
transport := quic.Transport{Conn: pc}
|
||||
transport.SetCreatedConn(true) // auto close conn
|
||||
transport.SetSingleUse(true) // auto close transport
|
||||
quicConn, err := transport.Dial(ctx, udpAddr, w.tlsConfig, w.quicConfig)
|
||||
if err != nil {
|
||||
_ = pc.Close()
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user