1
Fork 0
mirror of https://github.com/jech/galene.git synced 2024-11-22 16:45:58 +01:00

Make disk recording clients kickable.

Kick can no longer be called with groups locked.
This commit is contained in:
Juliusz Chroboczek 2020-09-12 14:00:14 +02:00
parent e37e27036e
commit 6f120f0333
3 changed files with 13 additions and 4 deletions

View file

@ -52,6 +52,12 @@ func (client *diskClient) Close() error {
return nil return nil
} }
func (client *diskClient) kick(message string) error {
err := client.Close()
delClient(client)
return err
}
func (client *diskClient) pushConn(id string, conn upConnection, tracks []upTrack, label string) error { func (client *diskClient) pushConn(id string, conn upConnection, tracks []upTrack, label string) error {
client.mu.Lock() client.mu.Lock()
defer client.mu.Unlock() defer client.mu.Unlock()

View file

@ -268,6 +268,12 @@ func (g *group) getClientsUnlocked(except client) []client {
return clients return clients
} }
func (g *group) getClient(id string) client {
g.mu.Lock()
defer g.mu.Unlock()
return g.getClientUnlocked(id)
}
func (g *group) getClientUnlocked(id string) client { func (g *group) getClientUnlocked(id string) client {
for idd, c := range g.clients { for idd, c := range g.clients {
if idd == id { if idd == id {

View file

@ -948,10 +948,7 @@ func (c *webClient) kick(message string) error {
} }
func kickClient(g *group, id string, message string) error { func kickClient(g *group, id string, message string) error {
g.mu.Lock() client := g.getClient(id)
defer g.mu.Unlock()
client := g.getClientUnlocked(id)
if client == nil { if client == nil {
return userError("no such user") return userError("no such user")
} }