mirror of
https://github.com/jech/galene.git
synced 2024-11-25 01:55:57 +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
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
|
|
|
@ -101,6 +101,6 @@ type Client interface {
|
|||
Status() map[string]interface{}
|
||||
OverridePermissions(*Group) bool
|
||||
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
|
||||
}
|
||||
|
|
|
@ -507,13 +507,11 @@ func AddClient(group string, c Client) (*Group, error) {
|
|||
u := c.Username()
|
||||
p := c.Permissions()
|
||||
s := c.Status()
|
||||
c.PushClient(c.Id(), u, p, s, "add")
|
||||
c.PushClient(c.Id(), u, &p, s, "add")
|
||||
for _, cc := range clients {
|
||||
c.PushClient(
|
||||
cc.Id(), cc.Username(), cc.Permissions(), cc.Status(),
|
||||
"add",
|
||||
)
|
||||
cc.PushClient(id, u, p, s, "add")
|
||||
pp := cc.Permissions()
|
||||
c.PushClient(cc.Id(), cc.Username(), &pp, cc.Status(), "add")
|
||||
cc.PushClient(id, u, &p, s, "add")
|
||||
}
|
||||
|
||||
return g, nil
|
||||
|
@ -559,7 +557,7 @@ func DelClient(c Client) {
|
|||
|
||||
go func(clients []Client) {
|
||||
for _, cc := range clients {
|
||||
cc.PushClient(c.Id(), c.Username(), c.Permissions(), c.Status(), "delete")
|
||||
cc.PushClient(c.Id(), "", nil, nil, "delete")
|
||||
}
|
||||
}(clients)
|
||||
|
||||
|
|
|
@ -111,13 +111,13 @@ func (c *webClient) OverridePermissions(g *group.Group) bool {
|
|||
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{
|
||||
Type: "user",
|
||||
Kind: kind,
|
||||
Id: id,
|
||||
Username: username,
|
||||
Permissions: &permissions,
|
||||
Permissions: permissions,
|
||||
Status: status,
|
||||
})
|
||||
}
|
||||
|
@ -989,7 +989,7 @@ func handleAction(c *webClient, a interface{}) error {
|
|||
clients := g.GetClients(nil)
|
||||
go func(clients []group.Client) {
|
||||
for _, cc := range clients {
|
||||
cc.PushClient(id, user, perms, s, "change")
|
||||
cc.PushClient(id, user, &perms, s, "change")
|
||||
}
|
||||
}(clients)
|
||||
case kickAction:
|
||||
|
@ -1479,7 +1479,7 @@ func handleClientMessage(c *webClient, m clientMessage) error {
|
|||
status := c.Status()
|
||||
go func(clients []group.Client) {
|
||||
for _, cc := range clients {
|
||||
cc.PushClient(id, user, perms, status,
|
||||
cc.PushClient(id, user, &perms, status,
|
||||
"change")
|
||||
}
|
||||
}(g.GetClients(nil))
|
||||
|
|
Loading…
Reference in a new issue