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