mirror of
https://github.com/jech/galene.git
synced 2024-11-09 18:25:58 +01:00
Don't send client parameters in delete message.
This avoids a race condition since the delete messages are sent asynchronously.
This commit is contained in:
parent
485b0c1b85
commit
26bf8a341a
4 changed files with 11 additions and 13 deletions
|
@ -75,7 +75,7 @@ func (client *Client) Status() map[string]interface{} {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (client *Client) PushClient(id, username string, permissions group.ClientPermissions, status map[string]interface{}, kind string) error {
|
func (client *Client) PushClient(id, username string, permissions *group.ClientPermissions, status map[string]interface{}, kind string) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -101,6 +101,6 @@ type Client interface {
|
||||||
Status() map[string]interface{}
|
Status() map[string]interface{}
|
||||||
OverridePermissions(*Group) bool
|
OverridePermissions(*Group) bool
|
||||||
PushConn(g *Group, id string, conn conn.Up, tracks []conn.UpTrack, replace string) error
|
PushConn(g *Group, id string, conn conn.Up, tracks []conn.UpTrack, replace string) error
|
||||||
PushClient(id, username string, permissions ClientPermissions, status map[string]interface{}, kind string) error
|
PushClient(id, username string, permissions *ClientPermissions, status map[string]interface{}, kind string) error
|
||||||
Kick(id, user, message string) error
|
Kick(id, user, message string) error
|
||||||
}
|
}
|
||||||
|
|
|
@ -507,13 +507,11 @@ func AddClient(group string, c Client) (*Group, error) {
|
||||||
u := c.Username()
|
u := c.Username()
|
||||||
p := c.Permissions()
|
p := c.Permissions()
|
||||||
s := c.Status()
|
s := c.Status()
|
||||||
c.PushClient(c.Id(), u, p, s, "add")
|
c.PushClient(c.Id(), u, &p, s, "add")
|
||||||
for _, cc := range clients {
|
for _, cc := range clients {
|
||||||
c.PushClient(
|
pp := cc.Permissions()
|
||||||
cc.Id(), cc.Username(), cc.Permissions(), cc.Status(),
|
c.PushClient(cc.Id(), cc.Username(), &pp, cc.Status(), "add")
|
||||||
"add",
|
cc.PushClient(id, u, &p, s, "add")
|
||||||
)
|
|
||||||
cc.PushClient(id, u, p, s, "add")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return g, nil
|
return g, nil
|
||||||
|
@ -559,7 +557,7 @@ func DelClient(c Client) {
|
||||||
|
|
||||||
go func(clients []Client) {
|
go func(clients []Client) {
|
||||||
for _, cc := range clients {
|
for _, cc := range clients {
|
||||||
cc.PushClient(c.Id(), c.Username(), c.Permissions(), c.Status(), "delete")
|
cc.PushClient(c.Id(), "", nil, nil, "delete")
|
||||||
}
|
}
|
||||||
}(clients)
|
}(clients)
|
||||||
|
|
||||||
|
|
|
@ -111,13 +111,13 @@ func (c *webClient) OverridePermissions(g *group.Group) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *webClient) PushClient(id, username string, permissions group.ClientPermissions, status map[string]interface{}, kind string) error {
|
func (c *webClient) PushClient(id, username string, permissions *group.ClientPermissions, status map[string]interface{}, kind string) error {
|
||||||
return c.write(clientMessage{
|
return c.write(clientMessage{
|
||||||
Type: "user",
|
Type: "user",
|
||||||
Kind: kind,
|
Kind: kind,
|
||||||
Id: id,
|
Id: id,
|
||||||
Username: username,
|
Username: username,
|
||||||
Permissions: &permissions,
|
Permissions: permissions,
|
||||||
Status: status,
|
Status: status,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -989,7 +989,7 @@ func handleAction(c *webClient, a interface{}) error {
|
||||||
clients := g.GetClients(nil)
|
clients := g.GetClients(nil)
|
||||||
go func(clients []group.Client) {
|
go func(clients []group.Client) {
|
||||||
for _, cc := range clients {
|
for _, cc := range clients {
|
||||||
cc.PushClient(id, user, perms, s, "change")
|
cc.PushClient(id, user, &perms, s, "change")
|
||||||
}
|
}
|
||||||
}(clients)
|
}(clients)
|
||||||
case kickAction:
|
case kickAction:
|
||||||
|
@ -1479,7 +1479,7 @@ func handleClientMessage(c *webClient, m clientMessage) error {
|
||||||
status := c.Status()
|
status := c.Status()
|
||||||
go func(clients []group.Client) {
|
go func(clients []group.Client) {
|
||||||
for _, cc := range clients {
|
for _, cc := range clients {
|
||||||
cc.PushClient(id, user, perms, status,
|
cc.PushClient(id, user, &perms, status,
|
||||||
"change")
|
"change")
|
||||||
}
|
}
|
||||||
}(g.GetClients(nil))
|
}(g.GetClients(nil))
|
||||||
|
|
Loading…
Reference in a new issue