mirror of
https://github.com/m1k1o/neko.git
synced 2025-05-22 21:47:08 +02:00
Refactor: session remove duplicate ID in endpoints.
This commit is contained in:
parent
e150203b54
commit
5c92b75cf7
7 changed files with 53 additions and 80 deletions
|
@ -71,11 +71,11 @@ func (ws *WebSocketHandler) Start() {
|
|||
}
|
||||
})
|
||||
|
||||
ws.sessions.OnBeforeDestroy(func(session types.Session) {
|
||||
if err := ws.handler.SessionDestroyed(session); err != nil {
|
||||
ws.logger.Warn().Str("id", session.ID()).Err(err).Msg("session destroyed with and error")
|
||||
ws.sessions.OnDestroy(func(id string) {
|
||||
if err := ws.handler.SessionDestroyed(id); err != nil {
|
||||
ws.logger.Warn().Str("id", id).Err(err).Msg("session destroyed with and error")
|
||||
} else {
|
||||
ws.logger.Debug().Str("id", session.ID()).Msg("session destroyed")
|
||||
ws.logger.Debug().Str("id", id).Msg("session destroyed")
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -94,8 +94,8 @@ func (ws *WebSocketHandler) Start() {
|
|||
if ws.sessions.HasHost() {
|
||||
text := ws.remote.ReadClipboard()
|
||||
if text != current {
|
||||
session, ok := ws.sessions.GetHost()
|
||||
if ok {
|
||||
session := ws.sessions.GetHost()
|
||||
if session != nil {
|
||||
if err := session.Send(message.Clipboard{
|
||||
Event: event.CONTROL_CLIPBOARD,
|
||||
Text: text,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue