public void HandleNode(Node current, Node origin, Message message, Network network) { foreach (Node neighbor in current.neighbors) { network.Enqueue(message, current, neighbor); } }
public void OnMessage(Node origin, Message message, Network network) { ++messagesReceived; if (messagesReceived == 1) { rcvTime = network.time; this.message = message; network.routingAlgorithm.HandleNode(this, origin, message, network); } }
public void HandleNode(Node current, Node origin, Message message, Network network) { if (message.hops >= k && random.NextDouble() > p) { return; } foreach (Node neighbor in current.neighbors) { network.Enqueue(message, current, neighbor); } }
public void Enqueue(Message m, Node origin, Node target) { NetworkMessage msg = new NetworkMessage(); msg.message = m; msg.target = target; msg.origin = origin; ++msg.message.hops; messages.Add(msg); }
public void StartMessage(Network network) { Message m = new Message(); network.routingAlgorithm.HandleNode(this, null, m, network); }