lib/connections: Do not leak FDs, fix address copy (fixes #5767) (#5768)

* lib/connections: Do not leak FDs, fix address copy (fixes #5767)

* build

* Update quic_listen.go

* Update quic_listen.go
This commit is contained in:
Audrius Butkevicius
2019-06-09 22:14:00 +01:00
committed by GitHub
parent 41ff4b323e
commit ee746263fb
3 changed files with 23 additions and 10 deletions

View File

@@ -24,15 +24,24 @@ var (
type quicTlsConn struct {
quic.Session
quic.Stream
// If we created this connection, we should be the ones closing it.
createdConn net.PacketConn
}
func (q *quicTlsConn) Close() error {
sterr := q.Stream.Close()
seerr := q.Session.Close()
var pcerr error
if q.createdConn != nil {
pcerr = q.createdConn.Close()
}
if sterr != nil {
return sterr
}
return seerr
if seerr != nil {
return seerr
}
return pcerr
}
// Sort available packet connections by ip address, preferring unspecified local address.