1
Fork 0
mirror of https://github.com/jech/galene.git synced 2024-11-25 10:05:58 +01:00

Avoid race between closing connections and terminating client.

We need to terminate all down connections synchronously, otherwise
we risk leaving open connections lying around.
This commit is contained in:
Juliusz Chroboczek 2021-02-05 12:20:33 +01:00
parent 66de0d16e7
commit c3a19c9128

View file

@ -1016,15 +1016,20 @@ func leaveGroup(c *webClient) {
return return
} }
c.setRequested(map[string]uint32{})
if c.up != nil { if c.up != nil {
for id := range c.up { for id := range c.up {
delUpConn(c, id, c.id, true) delUpConn(c, id, c.id, true)
} }
} }
if c.down != nil {
for id := range c.down {
delDownConn(c, id)
}
}
group.DelClient(c) group.DelClient(c)
c.permissions = group.ClientPermissions{} c.permissions = group.ClientPermissions{}
c.requested = map[string]uint32{}
c.group = nil c.group = nil
} }