Commit c860fb96 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Move server shutdown into group.go.

parent 184bd300
......@@ -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 {
......
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment