From c3a19c9128f2922d2285cc840dc9b633e0f625ce Mon Sep 17 00:00:00 2001 From: Juliusz Chroboczek Date: Fri, 5 Feb 2021 12:20:33 +0100 Subject: [PATCH] Avoid race between closing connections and terminating client. We need to terminate all down connections synchronously, otherwise we risk leaving open connections lying around. --- rtpconn/webclient.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/rtpconn/webclient.go b/rtpconn/webclient.go index a85dfa9..626f843 100644 --- a/rtpconn/webclient.go +++ b/rtpconn/webclient.go @@ -1016,15 +1016,20 @@ func leaveGroup(c *webClient) { return } - c.setRequested(map[string]uint32{}) if c.up != nil { for id := range c.up { delUpConn(c, id, c.id, true) } } + if c.down != nil { + for id := range c.down { + delDownConn(c, id) + } + } group.DelClient(c) c.permissions = group.ClientPermissions{} + c.requested = map[string]uint32{} c.group = nil }