forked from quic-go/quic-go
http3: close QUIC listeners created by Server on graceful shutdown (#5101)
This commit is contained in:
@@ -719,7 +719,20 @@ func (s *Server) Shutdown(ctx context.Context) error {
|
||||
return nil
|
||||
}
|
||||
s.graceCancel()
|
||||
|
||||
// close all listeners
|
||||
var closeErrs []error
|
||||
for _, l := range s.listeners {
|
||||
if l.createdLocally {
|
||||
if err := (*l.ln).Close(); err != nil {
|
||||
closeErrs = append(closeErrs, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
s.mutex.Unlock()
|
||||
if len(closeErrs) > 0 {
|
||||
return errors.Join(closeErrs...)
|
||||
}
|
||||
|
||||
if s.connCount.Load() == 0 {
|
||||
return s.Close()
|
||||
|
||||
Reference in New Issue
Block a user