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:
parent
89f0b3f94b
commit
5ab7617efd
@ -150,6 +150,8 @@ func (srv *Server) Shutdown(ctx context.Context) error {
|
|||||||
srv.closed = true
|
srv.closed = true
|
||||||
srv.shutdown = true
|
srv.shutdown = true
|
||||||
|
|
||||||
|
srv.tryCloseDoneLocked()
|
||||||
|
|
||||||
// Close all active listeners.
|
// Close all active listeners.
|
||||||
for _, cancel := range srv.listeners {
|
for _, cancel := range srv.listeners {
|
||||||
cancel()
|
cancel()
|
||||||
|
Loading…
Reference in New Issue
Block a user