public void Start()
        {
            _id   = _coordinator.GenerateNodeId();
            _info = new NodeRemoteInfo(_id, InternalNet.Endpoint, ExternalNet.Endpoint);
            Log   = LogManager.GetLogger(ToString());

            _coordinator.OnClusterViewChanged.Subscribe(ClusterViewChanged);
            _coordinator.JoinWith(this);

            ExternalNet.Start();
            InternalNet.Start();
        }
        public async Task <S2SPeer> GetNodePeer(ulong nodeId)
        {
            NodeRemoteInfo info = ClusterView.GetNode(nodeId);

            if (info.LocalConnectionId.HasValue)
            {
                return(InternalNet.GetPeer(info.LocalConnectionId.Value));
            }
            else
            {
                var peer = (S2SPeer)await InternalNet.Connect(info.InternalEndpoint);

                info.LocalConnectionId = peer.Channel.Id;
                return(peer);
            }
        }
 public void Stop()
 {
     ExternalNet.Stop();
     InternalNet.Stop();
 }