server: Fix Shutdown with no active listeners

Shutdown and Close will hang if there are no active listeners or
connections. Try to close the done channel to avoid that.
This commit is contained in:
Adnan Maolood 2021-02-23 09:27:03 -05:00
parent 89f0b3f94b
commit 5ab7617efd

View File

@ -150,6 +150,8 @@ func (srv *Server) Shutdown(ctx context.Context) error {
srv.closed = true
srv.shutdown = true
srv.tryCloseDoneLocked()
// Close all active listeners.
for _, cancel := range srv.listeners {
cancel()