Very minor tweaks

This commit is contained in:
Matthew Holt 2022-09-08 13:10:40 -06:00
parent 50748e19c3
commit 076a8b8095
No known key found for this signature in database
GPG Key ID: 2A349DD577D586A5
2 changed files with 5 additions and 3 deletions

View File

@ -87,6 +87,7 @@ func ListenPacket(network, addr string) (net.PacketConn, error) {
// ListenQUIC returns a quic.EarlyListener suitable for use in a Caddy module. // ListenQUIC returns a quic.EarlyListener suitable for use in a Caddy module.
// Note that the context passed to Accept is currently ignored, so using // Note that the context passed to Accept is currently ignored, so using
// a context other than context.Background is meaningless. // a context other than context.Background is meaningless.
// This API is EXPERIMENTAL and may change.
func ListenQUIC(addr string, tlsConf *tls.Config, activeRequests *int64) (quic.EarlyListener, error) { func ListenQUIC(addr string, tlsConf *tls.Config, activeRequests *int64) (quic.EarlyListener, error) {
lnKey := listenerKey("udp", addr) lnKey := listenerKey("udp", addr)
@ -112,8 +113,9 @@ func ListenQUIC(addr string, tlsConf *tls.Config, activeRequests *int64) (quic.E
ctx, cancel := context.WithCancel(context.Background()) ctx, cancel := context.WithCancel(context.Background())
return &fakeCloseQuicListener{ return &fakeCloseQuicListener{
sharedQuicListener: sharedEl.(*sharedQuicListener), sharedQuicListener: sharedEl.(*sharedQuicListener),
context: ctx, contextCancel: cancel, context: ctx,
}, err contextCancel: cancel,
}, nil
} }
// ListenerUsage returns the current usage count of the given listener address. // ListenerUsage returns the current usage count of the given listener address.

View File

@ -181,7 +181,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
// advertise HTTP/3, if enabled // advertise HTTP/3, if enabled
if s.h3server != nil { if s.h3server != nil {
// keep track of active requests for QUIC transport purposes (See AcceptToken callback in quic.Config) // keep track of active requests for QUIC transport purposes
atomic.AddInt64(&s.activeRequests, 1) atomic.AddInt64(&s.activeRequests, 1)
defer atomic.AddInt64(&s.activeRequests, -1) defer atomic.AddInt64(&s.activeRequests, -1)