http3: fix channel size in ListenAndServe (#4219)

* http3: typo in ListenAndServe docs

Also, partially prevent a goroutine leak on an error from one of the
listeners.

* http3: improve documentation for ListenAndServe

---------

Co-authored-by: Marten Seemann <martenseemann@gmail.com>
This commit is contained in:
Vladimir Varankin 2023-12-29 03:35:46 +01:00 committed by GitHub
parent 22411e16d5
commit a937959fbf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -723,7 +723,7 @@ func ListenAndServeQUIC(addr, certFile, keyFile string, handler http.Handler) er
return server.ListenAndServeTLS(certFile, keyFile)
}
// ListenAndServe listens on the given network address for both, TLS and QUIC
// ListenAndServe listens on the given network address for both TLS/TCP and QUIC
// connections in parallel. It returns if one of the two returns an error.
// http.DefaultServeMux is used when handler is nil.
// The correct Alt-Svc headers for QUIC are set.
@ -765,8 +765,8 @@ func ListenAndServe(addr, certFile, keyFile string, handler http.Handler) error
Handler: handler,
}
hErr := make(chan error)
qErr := make(chan error)
hErr := make(chan error, 1)
qErr := make(chan error, 1)
go func() {
hErr <- http.ListenAndServeTLS(addr, certFile, keyFile, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
quicServer.SetQuicHeaders(w.Header())