diff --git a/disk.go b/disk.go index 0095959..e5d0dc0 100644 --- a/disk.go +++ b/disk.go @@ -52,6 +52,12 @@ func (client *diskClient) Close() error { 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 { client.mu.Lock() defer client.mu.Unlock() diff --git a/group.go b/group.go index a980ee7..1744c40 100644 --- a/group.go +++ b/group.go @@ -268,6 +268,12 @@ func (g *group) getClientsUnlocked(except client) []client { 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 { for idd, c := range g.clients { if idd == id { diff --git a/webclient.go b/webclient.go index e20e0db..c4dfe83 100644 --- a/webclient.go +++ b/webclient.go @@ -948,10 +948,7 @@ func (c *webClient) kick(message string) error { } func kickClient(g *group, id string, message string) error { - g.mu.Lock() - defer g.mu.Unlock() - - client := g.getClientUnlocked(id) + client := g.getClient(id) if client == nil { return userError("no such user") }