1
This commit is contained in:
parent
1b8d3472a0
commit
5fc3b988dd
@ -17,3 +17,7 @@ type ConfigTable struct {
|
|||||||
func (this *ConfigTable) GetGameApiUrl() string {
|
func (this *ConfigTable) GetGameApiUrl() string {
|
||||||
return this.selfConf.GetGameapiUrl()
|
return this.selfConf.GetGameapiUrl()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *ConfigTable) GetSessionExpireTime() int32 {
|
||||||
|
return this.selfConf.GetSessionExpireTime()
|
||||||
|
}
|
||||||
|
@ -26,6 +26,7 @@ type MailDb struct {
|
|||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
gameapi_url string
|
gameapi_url string
|
||||||
|
session_expire_time int32
|
||||||
|
|
||||||
_flags1_ uint64
|
_flags1_ uint64
|
||||||
_flags2_ uint64
|
_flags2_ uint64
|
||||||
@ -103,6 +104,14 @@ func (this *Config) HasGameapiUrl() bool {
|
|||||||
return (this._flags1_ & (uint64(1) << 1)) > 0
|
return (this._flags1_ & (uint64(1) << 1)) > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *Config) GetSessionExpireTime() int32 {
|
||||||
|
return this.session_expire_time
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *Config) HasSessionExpireTime() bool {
|
||||||
|
return (this._flags1_ & (uint64(1) << 2)) > 0
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
func (this *MailCluster) LoadFromKv(kv map[string]interface{}) {
|
func (this *MailCluster) LoadFromKv(kv map[string]interface{}) {
|
||||||
f5.ReadMetaTableField(&this.instance_id, "instance_id", &this._flags1_, 1, kv)
|
f5.ReadMetaTableField(&this.instance_id, "instance_id", &this._flags1_, 1, kv)
|
||||||
@ -120,4 +129,5 @@ func (this *MailDb) LoadFromKv(kv map[string]interface{}) {
|
|||||||
|
|
||||||
func (this *Config) LoadFromKv(kv map[string]interface{}) {
|
func (this *Config) LoadFromKv(kv map[string]interface{}) {
|
||||||
f5.ReadMetaTableField(&this.gameapi_url, "gameapi_url", &this._flags1_, 1, kv)
|
f5.ReadMetaTableField(&this.gameapi_url, "gameapi_url", &this._flags1_, 1, kv)
|
||||||
|
f5.ReadMetaTableField(&this.session_expire_time, "session_expire_time", &this._flags1_, 2, kv)
|
||||||
}
|
}
|
||||||
|
@ -21,4 +21,5 @@ message MailDb
|
|||||||
message Config
|
message Config
|
||||||
{
|
{
|
||||||
optional string gameapi_url = 1;
|
optional string gameapi_url = 1;
|
||||||
|
optional int32 session_expire_time = 2;
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ import (
|
|||||||
"f5"
|
"f5"
|
||||||
"time"
|
"time"
|
||||||
"sync"
|
"sync"
|
||||||
|
"main/mt"
|
||||||
)
|
)
|
||||||
|
|
||||||
type userSession struct {
|
type userSession struct {
|
||||||
@ -52,10 +53,15 @@ func (this *sessionMgr) UpdateSession(accountId string, sessionId string) {
|
|||||||
session.sessionId = sessionId
|
session.sessionId = sessionId
|
||||||
session.lastUpdateTime = f5.GetApp().GetRealSeconds()
|
session.lastUpdateTime = f5.GetApp().GetRealSeconds()
|
||||||
this.idHash.Store(accountId, session)
|
this.idHash.Store(accountId, session)
|
||||||
session.timerWp = this.timer.SetIntervalWp(
|
session.timerWp = this.timer.SetTimeoutWp(
|
||||||
1,
|
mt.Table.Config.GetSessionExpireTime(),
|
||||||
func (e int32, args *q5.Args) {
|
func (e int32, args *q5.Args) {
|
||||||
|
if e == q5.TIMER_EXEC_EVENT {
|
||||||
|
nowTime := f5.GetApp().GetRealSeconds()
|
||||||
|
if nowTime - session.lastUpdateTime > 0 {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user