mirror of
https://github.com/jech/galene.git
synced 2024-11-23 00:55:58 +01:00
Make disk recording clients kickable.
Kick can no longer be called with groups locked.
This commit is contained in:
parent
e37e27036e
commit
6f120f0333
3 changed files with 13 additions and 4 deletions
6
disk.go
6
disk.go
|
@ -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()
|
||||||
|
|
6
group.go
6
group.go
|
@ -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 {
|
||||||
|
|
|
@ -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")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue