From 470f670865be7b1035f0f1f66900f991237ae453 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20=C5=A0ediv=C3=BD?= Date: Sun, 27 Mar 2022 00:32:21 +0100 Subject: [PATCH] private mode release control. --- internal/session/manager.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/internal/session/manager.go b/internal/session/manager.go index d1017de4..c7f43c1d 100644 --- a/internal/session/manager.go +++ b/internal/session/manager.go @@ -355,8 +355,16 @@ func (manager *SessionManagerCtx) UpdateSettings(new types.Settings) { if old.PrivateMode != new.PrivateMode { // update webrtc paused state for all sessions for _, session := range manager.List() { + enabled := session.PrivateModeEnabled() + + // if session had control, it must release it + if enabled && session.IsHost() { + manager.ClearHost() + } + + // its webrtc connection will be paused or unpaused if webrtcPeer := session.GetWebRTCPeer(); webrtcPeer != nil { - webrtcPeer.SetPaused(session.PrivateModeEnabled()) + webrtcPeer.SetPaused(enabled) } } }