diff --git a/services/comp_gateroute.go b/services/comp_gateroute.go index e4b2bef9e..a8e51f9bb 100644 --- a/services/comp_gateroute.go +++ b/services/comp_gateroute.go @@ -52,7 +52,10 @@ func (this *SComp_GateRouteComp) Start() (err error) { //注册路由 func (this *SComp_GateRouteComp) RegisterRoute(methodName string, comp reflect.Value, msg reflect.Type, fn reflect.Method) { log.Debugf("注册用户路由【%s】", methodName) - if _, ok := this.msghandles[methodName]; ok { + this.mrlock.RLock() + _, ok := this.msghandles[methodName] + this.mrlock.RUnlock() + if ok { log.Errorf("重复 注册网关消息【%s】", methodName) return }