From e1987a15789d7bf387ea1cf31ac8804c5964eb91 Mon Sep 17 00:00:00 2001 From: boyce Date: Fri, 22 Mar 2019 18:40:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E6=A8=A1=E5=9D=97=E6=97=B6?= =?UTF-8?q?=E9=AA=8C=E8=AF=81=E6=A8=A1=E5=9D=97id=E6=98=AF=E5=90=A6?= =?UTF-8?q?=E9=87=8D=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- service/Module.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/service/Module.go b/service/Module.go index f87dda7..a1d5f75 100644 --- a/service/Module.go +++ b/service/Module.go @@ -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()