func rawAddPeer(def *coredef.PeerDefine, peerIndex int32) { /// 运行时信息 peer := NewPeerData(def, pbcodec.GetInterface()) peer.Address = def.GetAddress() peer.NotifyAddress = def.GetNotifyAddress() peer.Index = peerIndex peer.ID = MakeServiceID(def.GetType(), def.GetName(), peerIndex) // 创建peer实现 p := CreatePeer(def.GetImplementor(), def.GetType(), peer) if p == nil { log.Printf("peer %s implementor not found, %s", peer.ID, def.GetImplementor()) return } // 记录 peerMap[peer.ID] = p.(IPeer) log.Printf("peer %s ready", peer.ID) }