aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdnan Maolood <[email protected]>2021-02-23 09:27:03 -0500
committerAdnan Maolood <[email protected]>2021-02-23 09:28:14 -0500
commit5ab7617efd91c6aa95a61014354a3dca65bd3af6 (patch)
tree5ab6fac4ebc8fda90dc3373c2b046f6d81711da7
parenttofu: Update documentation (diff)
downloadgo-gemini-5ab7617efd91c6aa95a61014354a3dca65bd3af6.tar.xz
go-gemini-5ab7617efd91c6aa95a61014354a3dca65bd3af6.zip
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.
-rw-r--r--server.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/server.go b/server.go
index c98b8d7..7d86181 100644
--- a/server.go
+++ b/server.go
@@ -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()