Example #1
0
 public void HandleNode(Node current, Node origin, Message message, Network network)
 {
     foreach (Node neighbor in current.neighbors)
     {
         network.Enqueue(message, current, neighbor);
     }
 }
Example #2
0
 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);
     }
 }
Example #3
0
        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);
            }
        }
Example #4
0
 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);
 }
Example #5
0
 public void StartMessage(Network network)
 {
     Message m = new Message();
     network.routingAlgorithm.HandleNode(this, null, m, network);
 }