From 303c22bba583beede6375256d7a32feda81da76a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20=C5=A0ediv=C3=BD?= Date: Sun, 6 Dec 2020 21:34:23 +0100 Subject: [PATCH] profileChanged tested, minor bugs fixed. --- internal/session/session.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/internal/session/session.go b/internal/session/session.go index c2ccdd57..14952d1f 100644 --- a/internal/session/session.go +++ b/internal/session/session.go @@ -62,6 +62,12 @@ func (session *SessionCtx) CanAccessClipboard() bool { func (session *SessionCtx) profileChanged() { if !session.CanHost() && session.IsHost() { session.manager.ClearHost() + + session.manager.Broadcast( + message.ControlHost{ + Event: event.CONTROL_HOST, + HasHost: false, + }, nil) } if !session.CanWatch() && session.IsWatching() { @@ -70,7 +76,7 @@ func (session *SessionCtx) profileChanged() { } } - if !session.CanConnect() && session.IsConnected() { + if (!session.CanConnect() || !session.CanLogin()) && session.IsConnected() { if err := session.Disconnect("profile changed"); err != nil { session.logger.Warn().Err(err).Msgf("websocket destroy has failed") }