mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
lint & logging fixes.
This commit is contained in:
parent
58d029f455
commit
a9aa62f062
@ -149,8 +149,10 @@ func (manager *MemberManagerCtx) Login(username string, password string) (types.
|
||||
return nil, "", fmt.Errorf("session is already connected")
|
||||
}
|
||||
|
||||
// delete existing session
|
||||
manager.sessions.Delete(id)
|
||||
// TODO: Replace session.
|
||||
if err := manager.sessions.Delete(id); err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
}
|
||||
|
||||
return manager.sessions.Create(id, profile)
|
||||
|
@ -117,10 +117,7 @@ func (manager *SessionManagerCtx) Delete(id string) error {
|
||||
return fmt.Errorf("Session id not found.")
|
||||
}
|
||||
|
||||
if _, ok := manager.tokens[session.token]; ok {
|
||||
delete(manager.tokens, session.token)
|
||||
}
|
||||
|
||||
delete(manager.tokens, session.token)
|
||||
delete(manager.sessions, id)
|
||||
manager.sessionsMu.Unlock()
|
||||
|
||||
|
@ -50,8 +50,8 @@ func (manager *WebSocketManagerCtx) fileChooserDialogEvents() {
|
||||
ID: activeSession.ID(),
|
||||
}); err != nil {
|
||||
manager.logger.Warn().
|
||||
Str("session_id", session.ID()).
|
||||
Err(err).
|
||||
Str("session_id", session.ID()).
|
||||
Msgf("could not send event `%s` to session", event.FILE_CHOOSER_DIALOG_OPENED)
|
||||
}
|
||||
})
|
||||
|
@ -27,5 +27,6 @@ func (h *MessageHandlerCtx) keyboardModifiers(session types.Session, payload *me
|
||||
NumLock: payload.NumLock,
|
||||
CapsLock: payload.CapsLock,
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
|
@ -29,5 +29,6 @@ func (h *MessageHandlerCtx) sendBroadcast(session types.Session, payload *messag
|
||||
Subject: payload.Subject,
|
||||
Body: payload.Body,
|
||||
}, []string{session.ID()})
|
||||
|
||||
return nil
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import (
|
||||
|
||||
func (h *MessageHandlerCtx) signalRequest(session types.Session) error {
|
||||
if !session.Profile().CanWatch {
|
||||
h.logger.Debug().Str("session_id", session.ID()).Msg("not allowed to watch")
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -33,7 +34,7 @@ func (h *MessageHandlerCtx) signalRequest(session types.Session) error {
|
||||
func (h *MessageHandlerCtx) signalAnswer(session types.Session, payload *message.SignalAnswer) error {
|
||||
peer := session.GetWebRTCPeer()
|
||||
if peer == nil {
|
||||
h.logger.Debug().Msg("webRTC peer does not exist")
|
||||
h.logger.Debug().Str("session_id", session.ID()).Msg("webRTC peer does not exist")
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -43,7 +44,7 @@ func (h *MessageHandlerCtx) signalAnswer(session types.Session, payload *message
|
||||
func (h *MessageHandlerCtx) signalCandidate(session types.Session, payload *message.SignalCandidate) error {
|
||||
peer := session.GetWebRTCPeer()
|
||||
if peer == nil {
|
||||
h.logger.Debug().Msg("webRTC peer does not exist")
|
||||
h.logger.Debug().Str("session_id", session.ID()).Msg("webRTC peer does not exist")
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -53,7 +54,7 @@ func (h *MessageHandlerCtx) signalCandidate(session types.Session, payload *mess
|
||||
func (h *MessageHandlerCtx) signalVideo(session types.Session, payload *message.SignalVideo) error {
|
||||
peer := session.GetWebRTCPeer()
|
||||
if peer == nil {
|
||||
h.logger.Debug().Msg("webRTC peer does not exist")
|
||||
h.logger.Debug().Str("session_id", session.ID()).Msg("webRTC peer does not exist")
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,6 @@ func (h *MessageHandlerCtx) systemInit(session types.Session) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// TODO: Sessions.
|
||||
sessions := map[string]message.SessionData{}
|
||||
for _, session := range h.sessions.List() {
|
||||
sessionId := session.ID()
|
||||
@ -52,11 +51,11 @@ func (h *MessageHandlerCtx) systemInit(session types.Session) error {
|
||||
func (h *MessageHandlerCtx) systemAdmin(session types.Session) error {
|
||||
screenSizesList := []message.ScreenSize{}
|
||||
for _, size := range h.desktop.ScreenConfigurations() {
|
||||
for _, fps := range size.Rates {
|
||||
for _, rate := range size.Rates {
|
||||
screenSizesList = append(screenSizesList, message.ScreenSize{
|
||||
Width: size.Width,
|
||||
Height: size.Height,
|
||||
Rate: fps,
|
||||
Rate: rate,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user