mirror of
https://github.com/duanhf2012/origin.git
synced 2026-02-04 06:54:45 +08:00
加入模块时验证模块id是否重复
This commit is contained in:
@@ -175,6 +175,12 @@ func (slf *BaseModule) AddModule(module IModule) uint32 {
|
||||
slf.rwModuleLocker = &sync.RWMutex{}
|
||||
}
|
||||
|
||||
pModule := slf.GetModuleById(module.GetModuleId())
|
||||
if pModule != nil {
|
||||
GetLogger().Printf(LEVER_ERROR, "%T Cannot AddModule %T,moduleid %d is repeat!", slf.GetSelf(), module.GetSelf(), module.GetModuleId())
|
||||
return 0
|
||||
}
|
||||
|
||||
locker := slf.GetRoot().getBaseModule().getLocker()
|
||||
locker.Lock()
|
||||
defer locker.Unlock()
|
||||
|
||||
Reference in New Issue
Block a user