diff --git a/group/group.go b/group/group.go index 82e6c39..2e8b31c 100644 --- a/group/group.go +++ b/group/group.go @@ -701,8 +701,12 @@ func kickall(g *Group, message string) { }) } -func (g *Group) Shutdown(message string) { - kickall(g, message) +func Shutdown(message string) { + Range(func(g *Group) bool { + g.SetLocked(true, message) + kickall(g, message) + return true + }) } type warner interface { diff --git a/webserver/webserver.go b/webserver/webserver.go index 3fdffce..e43a79a 100644 --- a/webserver/webserver.go +++ b/webserver/webserver.go @@ -70,10 +70,7 @@ func Serve(address string, dataDir string) error { } } s.RegisterOnShutdown(func() { - group.Range(func(g *group.Group) bool { - go g.Shutdown("server is shutting down") - return true - }) + group.Shutdown("server is shutting down") }) server.Store(s)