removed adaptive framerate tag and react to closed channels

This commit is contained in:
mbattista
2023-01-29 13:28:03 +01:00
committed by Miroslav Šedivý
parent ee13e40d4c
commit c45a315d9b
9 changed files with 202 additions and 177 deletions

View File

@ -103,7 +103,12 @@ type WebSocketHandler struct {
func (ws *WebSocketHandler) Start() {
go func() {
for {
channelMessage := <-ws.sessions.GetSessionChannel()
channelMessage, ok := <-ws.sessions.GetSessionChannel()
if !ok {
ws.logger.Info().Str("id", channelMessage.Id).Msg("session channel was closed")
// channel closed
return
}
switch channelMessage.Type {
case "created":
@ -189,7 +194,11 @@ func (ws *WebSocketHandler) Start() {
go func() {
for {
_ = <-ws.desktop.GetClipboardUpdatedChannel()
_, ok = <-ws.desktop.GetClipboardUpdatedChannel()
if !ok {
ws.logger.Info()).Msg("Clipboard update channel closed")
return
}
session, ok := ws.sessions.GetHost()
if !ok {
return