public IEndPoint GetMachine(NodeId node) { lock(nodeToMachine) { if(!nodeToMachine.ContainsKey(node)) return null; return nodeToMachine[node].SingleOrDefault(); } }
void GetNodesReply(RpcMail mail,IEndPoint ep, NodeId id, Dictionary<NodeId, List<IEndPoint>> nodes) { log.Info ("GetNodesReply", ep, id, nodes.Count); lock (nodeToMachine) { Add (ep, id); foreach (var kvp in nodes) foreach (var v in kvp.Value) Add (v, kvp.Key); } }
public void Add(IEndPoint machine, NodeId node) { lock(nodeToMachine) { if(!nodeToMachine.ContainsKey(node)) nodeToMachine[node] = new List<IEndPoint>(); if(!nodeToMachine[node].Contains(machine)) nodeToMachine[node].Add(machine); } NodeFound.FireEventAsync (machine, node); }
public bool Equals(NodeId n) { return n.Id == Id; }