diff --git a/server/statserver/session/sessionmgr.go b/server/statserver/session/sessionmgr.go index a846ccb9..fc509d20 100644 --- a/server/statserver/session/sessionmgr.go +++ b/server/statserver/session/sessionmgr.go @@ -53,13 +53,18 @@ func (this *sessionMgr) UpdateSession(accountId string, sessionId string) { session.sessionId = sessionId session.lastUpdateTime = f5.GetApp().GetRealSeconds() this.idHash.Store(accountId, session) + this.userOnline(session) session.timerWp = this.timer.SetTimeoutWp( mt.Table.Config.GetSessionExpireTime(), func (e int32, args *q5.Args) { if e == q5.TIMER_EXEC_EVENT { nowTime := f5.GetApp().GetRealSeconds() - if nowTime - session.lastUpdateTime > 0 { - + if nowTime - session.lastUpdateTime >= mt.Table.Config.GetSessionExpireTime() { + this.idHash.Delete(session.accountId) + this.timer.DeleteRunningTimer() + this.userOffline(session) + } else { + this.timer.ModifyTimer(session.timerWp, 10) } } }) @@ -82,3 +87,10 @@ func (this *sessionMgr) updateTimer() { time.Sleep(1 * time.Second); } } + + +func (this *sessionMgr) userOnline(session *userSession) { +} + +func (this *sessionMgr) userOffline(session *userSession) { +}