package gateway import ( "sync" "github.com/liwei1dao/lego/core" "github.com/liwei1dao/lego/core/cbase" ) type AgentMgr_Comp struct { cbase.ModuleCompBase agents *sync.Map } func (this *AgentMgr_Comp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { err = this.ModuleCompBase.Init(service, module, comp, options) this.agents = new(sync.Map) return } func (this *AgentMgr_Comp) Connect(a IAgent) { this.agents.Store(a.SessionId(), a) } func (this *AgentMgr_Comp) DisConnect(a IAgent) { this.agents.Delete(a.SessionId()) }