Carry group around when pushing connections.

This avoids a race condition if the group changes before the connections
are pushed.
This commit is contained in:
Juliusz Chroboczek
2020-12-05 00:07:34 +01:00
parent b134bfcf13
commit 0e7bf0b348
4 changed files with 49 additions and 36 deletions
+5 -1
View File
@@ -87,7 +87,11 @@ func (client *Client) Kick(id, user, message string) error {
return err
}
func (client *Client) PushConn(id string, up conn.Up, tracks []conn.UpTrack, label string) error {
func (client *Client) PushConn(g *group.Group, id string, up conn.Up, tracks []conn.UpTrack, label string) error {
if client.group != g {
return nil
}
client.mu.Lock()
defer client.mu.Unlock()