AddDisconnectedPair() public method

public AddDisconnectedPair ( Address &address1, Address &address2, bool nctunnel ) : void
address1 Address
address2 Address
nctunnel bool
return void
Exemplo n.º 1
0
        public static void Evaluator(RelayOverlapSimulator sim)
        {
            Address addr1 = null, addr2 = null;

            sim.AddDisconnectedPair(out addr1, out addr2, true);
            Run(sim, addr1, addr2);
            sim.AddDisconnectedPair(addr1, addr2, false);
            Run(sim, addr1, addr2);
            sim.AddDisconnectedPair(addr1, addr2, false);
            Run(sim, addr1, addr2);
            sim.AddDisconnectedPair(addr1, addr2, false);
            Run(sim, addr1, addr2);
            sim.AddDisconnectedPair(addr1, addr2, false);
            Run(sim, addr1, addr2);
            Console.WriteLine("NC Tests");
            sim.AddDisconnectedPair(addr1, addr2, true);
            Run(sim, addr1, addr2);
            sim.AddDisconnectedPair(addr1, addr2, true);
            Run(sim, addr1, addr2);
            sim.AddDisconnectedPair(addr1, addr2, true);
            Run(sim, addr1, addr2);
            sim.AddDisconnectedPair(addr1, addr2, true);
            Run(sim, addr1, addr2);
            sim.AddDisconnectedPair(addr1, addr2, true);
            Run(sim, addr1, addr2);
        }
Exemplo n.º 2
0
        public void Relays()
        {
            Parameters p = new Parameters("Test", "Test");

            string[] args = "-s=100".Split(' ');
            Assert.AreNotEqual(-1, p.Parse(args), "Unable to parse" + p.ErrorMessage);;
            RelayOverlapSimulator sim = new RelayOverlapSimulator(p);

            Address addr1 = null, addr2 = null;

            sim.AddDisconnectedPair(out addr1, out addr2, sim.NCEnable);
            sim.Complete(true);
            SimpleTimer.RunSteps(1000000, false);

            Node node1 = (sim.Nodes[addr1] as NodeMapping).Node as Node;
            Node node2 = (sim.Nodes[addr2] as NodeMapping).Node as Node;

            if (node1.ConnectionTable.GetConnection(ConnectionType.Structured, addr2) != null)
            {
                Relays();
                return;
            }

            ManagedConnectionOverlord mco = new ManagedConnectionOverlord(node1);

            mco.Start();
            node1.AddConnectionOverlord(mco);
            mco.Set(addr2);
            sim.Complete(true);
            SimpleTimer.RunSteps(100000, false);

            Assert.IsTrue(node1.ConnectionTable.GetConnection(ConnectionType.Structured, addr2) != null);

            foreach (Connection con in node1.ConnectionTable.GetConnections(Relay.OverlapConnectionOverlord.STRUC_OVERLAP))
            {
                con.Edge.Close();
            }
            foreach (Connection con in node2.ConnectionTable.GetConnections(Relay.OverlapConnectionOverlord.STRUC_OVERLAP))
            {
                con.Edge.Close();
            }

            SimpleTimer.RunSteps(100000, false);
            Assert.IsTrue(node1.ConnectionTable.GetConnection(ConnectionType.Structured, addr2) != null);
            sim.Disconnect();
        }
Exemplo n.º 3
0
        public void Relays()
        {
            Parameters p = new Parameters("Test", "Test");

            string[] args = "-s=100".Split(' ');
            Assert.AreNotEqual(-1, p.Parse(args), "Unable to parse" + p.ErrorMessage);
            RelayOverlapSimulator sim = new RelayOverlapSimulator(p);

            _sim = sim;

            Address addr1 = null, addr2 = null;
            Node    node1 = null, node2 = null;

            while (true)
            {
                sim.AddDisconnectedPair(out addr1, out addr2, sim.NCEnable);
                sim.Complete(true);

                node1 = (sim.Nodes[addr1] as NodeMapping).Node as Node;
                node2 = (sim.Nodes[addr2] as NodeMapping).Node as Node;

                if (!Simulator.AreConnected(node1, node2))
                {
                    break;
                }
            }

            ManagedConnectionOverlord mco = new ManagedConnectionOverlord(node1);

            mco.Start();
            node1.AddConnectionOverlord(mco);
            mco.Set(addr2);
            Assert.IsTrue(AreConnected(node1, node2));

            foreach (Connection con in node1.ConnectionTable.GetConnections(Relay.OverlapConnectionOverlord.STRUC_OVERLAP))
            {
                con.State.Edge.Close();
            }
            foreach (Connection con in node2.ConnectionTable.GetConnections(Relay.OverlapConnectionOverlord.STRUC_OVERLAP))
            {
                con.State.Edge.Close();
            }

            Assert.IsTrue(Simulator.AreConnected(node1, node2));
        }
Exemplo n.º 4
0
    public void Relays() {
      Parameters p = new Parameters("Test", "Test");
      string[] args = "-s=100".Split(' ');
      Assert.AreNotEqual(-1, p.Parse(args), "Unable to parse" + p.ErrorMessage);;
      RelayOverlapSimulator sim = new RelayOverlapSimulator(p);

      Address addr1 = null, addr2 = null;
      sim.AddDisconnectedPair(out addr1, out addr2, sim.NCEnable);
      sim.Complete(true);
      SimpleTimer.RunSteps(1000000, false);

      Node node1 = (sim.Nodes[addr1] as NodeMapping).Node as Node;
      Node node2 = (sim.Nodes[addr2] as NodeMapping).Node as Node;

      if(node1.ConnectionTable.GetConnection(ConnectionType.Structured, addr2) != null) {
        Relays();
        return;
      }

      ManagedConnectionOverlord mco = new ManagedConnectionOverlord(node1);
      mco.Start();
      node1.AddConnectionOverlord(mco);
      mco.Set(addr2);
      sim.Complete(true);
      SimpleTimer.RunSteps(100000, false);

      Assert.IsTrue(node1.ConnectionTable.GetConnection(ConnectionType.Structured, addr2) != null);

      foreach(Connection con in node1.ConnectionTable.GetConnections(Relay.OverlapConnectionOverlord.STRUC_OVERLAP)) {
        con.Edge.Close();
      }
      foreach(Connection con in node2.ConnectionTable.GetConnections(Relay.OverlapConnectionOverlord.STRUC_OVERLAP)) {
        con.Edge.Close();
      }

      SimpleTimer.RunSteps(100000, false);
      Assert.IsTrue(node1.ConnectionTable.GetConnection(ConnectionType.Structured, addr2) != null);
      sim.Disconnect();
    }
Exemplo n.º 5
0
        // Static Members

        public static void Simulator(RelayOverlapSimulator sim)
        {
            Address addr1 = null, addr2 = null;

            sim.AddDisconnectedPair(out addr1, out addr2, sim.NCEnable);
            sim.Complete(false);
            SimpleTimer.RunSteps(1000000, false);

            StructuredNode node1 = (sim.Nodes[addr1] as NodeMapping).Node as StructuredNode;
            StructuredNode node2 = (sim.Nodes[addr2] as NodeMapping).Node as StructuredNode;

            ManagedConnectionOverlord mco = new ManagedConnectionOverlord(node1);

            mco.Start();
            node1.AddConnectionOverlord(mco);
            mco.Set(addr2);
            SimpleTimer.RunSteps(100000, false);

            Console.WriteLine(addr1 + "<=>" + addr2 + ":");
            Console.WriteLine("\t" + node1.ConnectionTable.GetConnection(ConnectionType.Structured, addr2) + "\n");
            sim.PrintConnections(node1);
            Console.WriteLine();
            sim.PrintConnections(node2);

            Console.WriteLine("\nPhase 2 -- Disconnect...");
            sim.FindOverlap(node1, node2);
            sim.CloseOverlap(node1);
            sim.CloseOverlap(node2);

            SimpleTimer.RunSteps(100000, false);

            Console.WriteLine(addr1 + "<=>" + addr2 + ":");
            Console.WriteLine("\t" + node1.ConnectionTable.GetConnection(ConnectionType.Structured, addr2) + "\n");
            sim.PrintConnections(node1);
            Console.WriteLine();
            sim.PrintConnections(node2);

            sim.Disconnect();
        }
Exemplo n.º 6
0
 public static void Evaluator(RelayOverlapSimulator sim)
 {
   Address addr1 = null, addr2 = null;
   sim.AddDisconnectedPair(out addr1, out addr2, true);
   Run(sim, addr1, addr2);
   sim.AddDisconnectedPair(addr1, addr2, false);
   Run(sim, addr1, addr2);
   sim.AddDisconnectedPair(addr1, addr2, false);
   Run(sim, addr1, addr2);
   sim.AddDisconnectedPair(addr1, addr2, false);
   Run(sim, addr1, addr2);
   sim.AddDisconnectedPair(addr1, addr2, false);
   Run(sim, addr1, addr2);
   Console.WriteLine("NC Tests");
   sim.AddDisconnectedPair(addr1, addr2, true);
   Run(sim, addr1, addr2);
   sim.AddDisconnectedPair(addr1, addr2, true);
   Run(sim, addr1, addr2);
   sim.AddDisconnectedPair(addr1, addr2, true);
   Run(sim, addr1, addr2);
   sim.AddDisconnectedPair(addr1, addr2, true);
   Run(sim, addr1, addr2);
   sim.AddDisconnectedPair(addr1, addr2, true);
   Run(sim, addr1, addr2);
 }
Exemplo n.º 7
0
    // Static Members

    public static void Simulator(RelayOverlapSimulator sim)
    {
      Address addr1 = null, addr2 = null;
      sim.AddDisconnectedPair(out addr1, out addr2, sim.NCEnable);
      sim.Complete(false);
      SimpleTimer.RunSteps(1000000, false);

      StructuredNode node1 = (sim.Nodes[addr1] as NodeMapping).Node as StructuredNode;
      StructuredNode node2 = (sim.Nodes[addr2] as NodeMapping).Node as StructuredNode;

      ManagedConnectionOverlord mco = new ManagedConnectionOverlord(node1);
      mco.Start();
      node1.AddConnectionOverlord(mco);
      mco.Set(addr2);
      SimpleTimer.RunSteps(100000, false);

      Console.WriteLine(addr1 + "<=>" + addr2 + ":");
      Console.WriteLine("\t" + node1.ConnectionTable.GetConnection(ConnectionType.Structured, addr2) + "\n");
      sim.PrintConnections(node1);
      Console.WriteLine();
      sim.PrintConnections(node2);

      Console.WriteLine("\nPhase 2 -- Disconnect...");
      sim.FindOverlap(node1, node2);
      sim.CloseOverlap(node1);
      sim.CloseOverlap(node2);

      SimpleTimer.RunSteps(100000, false);

      Console.WriteLine(addr1 + "<=>" + addr2 + ":");
      Console.WriteLine("\t" + node1.ConnectionTable.GetConnection(ConnectionType.Structured, addr2) + "\n");
      sim.PrintConnections(node1);
      Console.WriteLine();
      sim.PrintConnections(node2);

      sim.Disconnect();
    }
Exemplo n.º 8
0
    public void Relays() {
      Parameters p = new Parameters("Test", "Test");
      string[] args = "-s=100".Split(' ');
      Assert.AreNotEqual(-1, p.Parse(args), "Unable to parse" + p.ErrorMessage);
      RelayOverlapSimulator sim = new RelayOverlapSimulator(p);
      _sim = sim;

      Address addr1 = null, addr2 = null;
      Node node1 = null, node2 = null;
      while(true) {
        sim.AddDisconnectedPair(out addr1, out addr2, sim.NCEnable);
        sim.Complete(true);

        node1 = (sim.Nodes[addr1] as NodeMapping).Node as Node;
        node2 = (sim.Nodes[addr2] as NodeMapping).Node as Node;

        if(!Simulator.AreConnected(node1, node2)) {
          break;
        }
      }

      ManagedConnectionOverlord mco = new ManagedConnectionOverlord(node1);
      mco.Start();
      node1.AddConnectionOverlord(mco);
      mco.Set(addr2);
      Assert.IsTrue(AreConnected(node1, node2));

      foreach(Connection con in node1.ConnectionTable.GetConnections(Relay.OverlapConnectionOverlord.STRUC_OVERLAP)) {
        con.Edge.Close();
      }
      foreach(Connection con in node2.ConnectionTable.GetConnections(Relay.OverlapConnectionOverlord.STRUC_OVERLAP)) {
        con.Edge.Close();
      }

      Assert.IsTrue(Simulator.AreConnected(node1, node2));
    }