Skip to content

Commit

Permalink
core: Fix ListenQUIC listener key conflict
Browse files Browse the repository at this point in the history
Reported on commit e3e8aab

Abused this change in some bash for loops to rapidly reload config
while making requests and didn't observe any memory or resource leaks.
  • Loading branch information
mholt committed Sep 29, 2022
1 parent e2991eb commit ab720fb
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions listeners.go
Expand Up @@ -436,7 +436,7 @@ func ListenPacket(network, addr string) (net.PacketConn, error) {
//
// TODO: See if we can find a more elegant solution closer to the new NetworkAddress.Listen API.
func ListenQUIC(ln net.PacketConn, tlsConf *tls.Config, activeRequests *int64) (quic.EarlyListener, error) {
lnKey := listenerKey(ln.LocalAddr().Network(), ln.LocalAddr().String())
lnKey := listenerKey("quic+"+ln.LocalAddr().Network(), ln.LocalAddr().String())

sharedEarlyListener, _, err := listenerPool.LoadOrNew(lnKey, func() (Destructor, error) {
earlyLn, err := quic.ListenEarly(ln, http3.ConfigureTLSConfig(tlsConf), &quic.Config{
Expand All @@ -451,7 +451,6 @@ func ListenQUIC(ln net.PacketConn, tlsConf *tls.Config, activeRequests *int64) (
if err != nil {
return nil, err
}

return &sharedQuicListener{EarlyListener: earlyLn, key: lnKey}, nil
})
if err != nil {
Expand Down

0 comments on commit ab720fb

Please sign in to comment.