Commit 6f120f03 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Make disk recording clients kickable.

Kick can no longer be called with groups locked.
parent e37e2703
...@@ -52,6 +52,12 @@ func (client *diskClient) Close() error { ...@@ -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()
......
...@@ -268,6 +268,12 @@ func (g *group) getClientsUnlocked(except client) []client { ...@@ -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 { ...@@ -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")
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment