1
Fork 0

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
1 changed files with 6 additions and 1 deletions

View File

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