Пример #1
0
 public void AddNode(Node node)
 {
     //Add node if we are not already established or trying to establish
     if (!EstablishedPeers.ContainsKey(node.Id) &&
         PendingPeers.All(p => p.Node.Id != node.Id) &&
         NewNodes.All(n => n.Id != node.Id))
     {
         NewNodes.Add(node);
     }
 }
Пример #2
0
 public void RemoveNode(Node node)
 {
     Peer peer;
     if (EstablishedPeers.TryRemove(node.Id, out peer))
     {
         peer.Session.Disconnect();
     }
 }
Пример #3
0
 public NodeAsync()
 {
     _self = new Node();
 }