mirror of
https://github.com/jech/galene.git
synced 2024-11-09 18:25:58 +01:00
Push clients synchronously.
Doing this asynchronously was racy -- under extreme circumstances, a client could be deleted before it was added.
This commit is contained in:
parent
3c7b32056b
commit
fa625c693e
1 changed files with 5 additions and 6 deletions
|
@ -485,15 +485,14 @@ func AddClient(group string, c Client) (*Group, error) {
|
|||
g.clients[c.Id()] = c
|
||||
g.timestamp = time.Now()
|
||||
|
||||
go func(clients []Client) {
|
||||
u := c.Username()
|
||||
c.PushClient(c.Id(), u, true)
|
||||
u := c.Username()
|
||||
c.PushClient(c.Id(), u, true)
|
||||
for _, c := range clients {
|
||||
for _, cc := range clients {
|
||||
uu := cc.Username()
|
||||
c.PushClient(cc.Id(), uu, true)
|
||||
c.PushClient(cc.Id(), cc.Username(), true)
|
||||
cc.PushClient(c.Id(), u, true)
|
||||
}
|
||||
}(clients)
|
||||
}
|
||||
|
||||
return g, nil
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue