mirror of
https://github.com/jech/galene.git
synced 2024-11-22 08:35:57 +01:00
Move server shutdown into group.go.
This commit is contained in:
parent
184bd30077
commit
c860fb96a3
2 changed files with 7 additions and 6 deletions
|
@ -701,8 +701,12 @@ func kickall(g *Group, message string) {
|
|||
})
|
||||
}
|
||||
|
||||
func (g *Group) Shutdown(message string) {
|
||||
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)
|
||||
|
|
Loading…
Reference in a new issue