Fix quic-go write leak

This commit is contained in:
世界
2026-07-09 10:42:30 +08:00
parent 0f1763877c
commit 7067276170
6 changed files with 31 additions and 3 deletions

View File

@@ -78,6 +78,12 @@ func (c *Client) offerNew() (*quic.Conn, error) {
packetConn.Close()
return nil, err
}
// quic-go does not take ownership of the packet conn passed to Dial:
// when the connection ends it only stops reading.
go func() {
<-quicConn.Context().Done()
packetConn.Close()
}()
c.conn.Store(quicConn)
c.rawConn = udpConn
return quicConn, nil