mirror of
https://github.com/duanhf2012/origin.git
synced 2026-02-15 08:14:46 +08:00
修改集群结点配置自己身的结点名称,导致rpc call失败
This commit is contained in:
@@ -221,8 +221,8 @@ func (slf *CCluster) Call(NodeServiceMethod string, args interface{}, reply inte
|
||||
var callServiceName string
|
||||
nodeidList := slf.GetNodeList(NodeServiceMethod, &callServiceName)
|
||||
if len(nodeidList) > 1 || len(nodeidList) < 1 {
|
||||
service.GetLogger().Printf(sysmodule.LEVER_ERROR, "CCluster.Call(%s) not find nodes.", NodeServiceMethod)
|
||||
return fmt.Errorf("CCluster.Call(%s) not find nodes.", NodeServiceMethod)
|
||||
service.GetLogger().Printf(sysmodule.LEVER_ERROR, "CCluster.Call(%s) find nodes count %d is error.", NodeServiceMethod, len(nodeidList))
|
||||
return fmt.Errorf("CCluster.Call(%s) find nodes count %d is error.", NodeServiceMethod, len(nodeidList))
|
||||
}
|
||||
|
||||
nodeid := nodeidList[0]
|
||||
|
||||
@@ -81,7 +81,10 @@ func ReadCfg(path string, nodeid int) (*ClusterConfig, error) {
|
||||
for _, cn := range custerNodeName {
|
||||
for _, n := range c.mapIdNode {
|
||||
if n.NodeName == cn {
|
||||
c.mapClusterNodeService[n.NodeName] = append(c.mapClusterNodeService[n.NodeName], n)
|
||||
nodeList := c.mapClusterNodeService[n.NodeName]
|
||||
if IsExistsNode(nodeList, &n) == false {
|
||||
c.mapClusterNodeService[n.NodeName] = append(c.mapClusterNodeService[n.NodeName], n)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -143,3 +146,13 @@ func (slf *ClusterConfig) HasLocalService(serviceName string) bool {
|
||||
_, ok := slf.currentNode.ServiceList[serviceName]
|
||||
return ok == true
|
||||
}
|
||||
|
||||
func IsExistsNode(nodelist []CNode, pNode *CNode) bool {
|
||||
for _, node := range nodelist {
|
||||
if node.NodeID == pNode.NodeID {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user