1
Fork 0

Delete empty groups.

This commit is contained in:
Juliusz Chroboczek 2020-04-25 02:01:04 +02:00
parent f5a518a448
commit 2cb323ec31
1 changed files with 4 additions and 4 deletions

View File

@ -111,10 +111,7 @@ func addGroup(name string) (*group, error) {
return g, nil
}
func delGroup(name string) bool {
groups.mu.Lock()
defer groups.mu.Unlock()
func delGroupUnlocked(name string) bool {
g := groups.groups[name]
if g == nil {
return true
@ -158,6 +155,9 @@ func delClient(c *client) {
g.clients =
append(g.clients[:i], g.clients[i+1:]...)
c.group = nil
if len(g.clients) == 0 {
delGroupUnlocked(g.name)
}
return
}
}