mirror of
https://github.com/m1k1o/neko.git
synced 2025-06-01 02:12:42 +02:00
websocket handler simplified logging.
This commit is contained in:
parent
c2fe224562
commit
5130d94bbc
8 changed files with 29 additions and 52 deletions
|
@ -1,6 +1,8 @@
|
|||
package handler
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"demodesk/neko/internal/types"
|
||||
"demodesk/neko/internal/types/event"
|
||||
"demodesk/neko/internal/types/message"
|
||||
|
@ -26,16 +28,12 @@ func (h *MessageHandlerCtx) controlRelease(session types.Session) error {
|
|||
}
|
||||
|
||||
func (h *MessageHandlerCtx) controlRequest(session types.Session) error {
|
||||
logger := h.logger.With().Str("session_id", session.ID()).Logger()
|
||||
|
||||
if !session.Profile().CanHost {
|
||||
logger.Debug().Msg("is not allowed to host")
|
||||
return nil
|
||||
return errors.New("is not allowed to host")
|
||||
}
|
||||
|
||||
if session.IsHost() {
|
||||
logger.Debug().Msg("is already the host")
|
||||
return nil
|
||||
return errors.New("is already the host")
|
||||
}
|
||||
|
||||
if !h.sessions.ImplicitHosting() {
|
||||
|
@ -53,6 +51,5 @@ func (h *MessageHandlerCtx) controlRequest(session types.Session) error {
|
|||
}
|
||||
|
||||
h.sessions.SetHost(session)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue