From 53ebf9846736b4e7dcaa5bcce9dd2f1daa834a92 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Sat, 25 May 2024 11:15:20 +0800 Subject: [PATCH] 1 --- server/statserver/session/sessionmgr.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/server/statserver/session/sessionmgr.go b/server/statserver/session/sessionmgr.go index 1a6081ef..a8974e99 100644 --- a/server/statserver/session/sessionmgr.go +++ b/server/statserver/session/sessionmgr.go @@ -1,12 +1,31 @@ package session import ( + "q5" "sync" ) +type session struct { + accountId string + lastUpdateTick int64 +} + type sessionMgr struct { idHash sync.Map } func (this *sessionMgr) UpdateSession(accountId string, sessionId string) { + session := this.getSession(accountId) + if session != nil { + session.lastUpdateTick = q5.GetTickCount() + return + } +} + +func (this *sessionMgr) getSession(accountId string) *session { + if p, ok := this.idHash.Load(accountId); ok { + return p.(*session) + } else { + return nil + } }