mirror of
https://github.com/jech/galene.git
synced 2024-11-12 19:55:59 +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.clients[c.Id()] = c
|
||||||
g.timestamp = time.Now()
|
g.timestamp = time.Now()
|
||||||
|
|
||||||
go func(clients []Client) {
|
u := c.Username()
|
||||||
u := c.Username()
|
c.PushClient(c.Id(), u, true)
|
||||||
c.PushClient(c.Id(), u, true)
|
for _, c := range clients {
|
||||||
for _, cc := range clients {
|
for _, cc := range clients {
|
||||||
uu := cc.Username()
|
c.PushClient(cc.Id(), cc.Username(), true)
|
||||||
c.PushClient(cc.Id(), uu, true)
|
|
||||||
cc.PushClient(c.Id(), u, true)
|
cc.PushClient(c.Id(), u, true)
|
||||||
}
|
}
|
||||||
}(clients)
|
}
|
||||||
|
|
||||||
return g, nil
|
return g, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue