示例#1
0
        private void JoinCluster(NodeHeader networkNode)
        {
            Node node = AddNode(networkNode);

            if (node.Status == NodeStatus.Alive)
            {
                ClusterWelcomeMessage welcome = node.RegisterNode(Header);

                foreach (var item in welcome.NodeList)
                {
                    if (item.ID == Header.ID)
                    {
                        continue;
                    }

                    Node hop = AddNode(item);

                    if (hop.Status == NodeStatus.Alive)
                    {
                        hop.RegisterNode(Header);
                    }
                }
            }

            leaderNode = nodeList.Leader;
        }
示例#2
0
        public ClusterWelcomeMessage RegisterNode(NodeHeader node)
        {
            AddNode(node);

            ClusterWelcomeMessage message = new ClusterWelcomeMessage();

            message.NodeID   = Header;
            message.NodeList = nodeList.ToHeaderList();

            return(message);
        }