diff --git a/hub.go b/hub.go index 31b5392..7c11e01 100644 --- a/hub.go +++ b/hub.go @@ -99,13 +99,14 @@ loop: } }) case m := <-h.exit: + h.open.Store(false) + h.sessions.each(func(s *Session) { s.writeMessage(m) s.Close() }) h.sessions.clear() - h.open.Store(false) break loop }