Fix set hub to closed before closing sessions

This commit is contained in:
Ola
2024-03-30 17:45:32 +01:00
parent 18ed1feac2
commit b1236e724a
+2 -1
View File
@@ -99,13 +99,14 @@ loop:
} }
}) })
case m := <-h.exit: case m := <-h.exit:
h.open.Store(false)
h.sessions.each(func(s *Session) { h.sessions.each(func(s *Session) {
s.writeMessage(m) s.writeMessage(m)
s.Close() s.Close()
}) })
h.sessions.clear() h.sessions.clear()
h.open.Store(false)
break loop break loop
} }