UpdateNeighborIntersection() public method

When our tunnel peer has some state change, he notifies us and use that information to update our overlap, here we set the overlap.
public UpdateNeighborIntersection ( List neighbors ) : void
neighbors List
return void
示例#1
0
        public void Test()
        {
            AHAddress        addr = new AHAddress(new System.Security.Cryptography.RNGCryptoServiceProvider());
            TransportAddress ta   = TransportAddressFactory.CreateInstance("brunet.tcp://169.0.5.1:5000");
            FakeEdge         fe   = new FakeEdge(ta, ta);
            Connection       fcon = new Connection(fe, addr, "structured", null, null);

            List <Connection> overlap = new List <Connection>();

            overlap.Add(fcon);
            TunnelTransportAddress tta   = new TunnelTransportAddress(addr, overlap);
            TunnelEdge             te1   = new TunnelEdge(null, tta, tta, new SimpleForwarderSelector(), overlap);
            Connection             t1con = new Connection(te1, addr, "structured", null, null);

            overlap = new List <Connection>();
            overlap.Add(t1con);
            TunnelEdge te2   = new TunnelEdge(null, tta, tta, new SimpleForwarderSelector(), overlap);
            Connection t2con = new Connection(te2, addr, "structured", null, null);

            overlap = new List <Connection>();
            overlap.Add(t2con);
            TunnelEdge te3   = new TunnelEdge(null, tta, tta, new SimpleForwarderSelector(), overlap);
            Connection t3con = new Connection(te3, addr, "structured", null, null);

            overlap = new List <Connection>();
            overlap.Add(t3con);
            TunnelEdge te4   = new TunnelEdge(null, tta, tta, new SimpleForwarderSelector(), overlap);
            Connection t4con = new Connection(te4, addr, "structured", null, null);

            overlap = new List <Connection>();
            overlap.Add(t4con);
            TunnelEdge te5   = new TunnelEdge(null, tta, tta, new SimpleForwarderSelector(), overlap);
            Connection t5con = new Connection(te5, addr, "structured", null, null);

            Assert.AreEqual(te5.ShouldClose(), false, "Shouldn't close yet...");
            te1.DisconnectionHandler(fcon);
            Assert.AreEqual(te5.ShouldClose(), true, "Should close...");

            overlap.Add(t5con);
            overlap.Add(t3con);
            overlap.Add(t1con);
            te2.UpdateNeighborIntersection(overlap);
            Assert.AreEqual(te5.ShouldClose(), true, "Should close... 2");
        }
示例#2
0
 /// <summary>Whenever the node receives a new StatusMessage from a tunnel,
 /// we use this to build a consisting of the intersection of our peers
 /// creating a table of potential tunneling options.  We close the edge if
 /// it is empty.</summary>
 protected void UpdateNeighborIntersection(TunnelEdge from, IDictionary msg)
 {
   List<Connection> overlap = _ito.EvaluateOverlap(_connections, msg);
   from.UpdateNeighborIntersection(overlap);
 }
示例#3
0
        /// <summary>Whenever the node receives a new StatusMessage from a tunnel,
        /// we use this to build a consisting of the intersection of our peers
        /// creating a table of potential tunneling options.  We close the edge if
        /// it is empty.</summary>
        protected void UpdateNeighborIntersection(TunnelEdge from, IDictionary msg)
        {
            List <Connection> overlap = _ito.EvaluateOverlap(_connections, msg);

            from.UpdateNeighborIntersection(overlap);
        }
示例#4
0
    public void Test()
    {
      AHAddress addr = new AHAddress(new System.Security.Cryptography.RNGCryptoServiceProvider());
      TransportAddress ta = TransportAddressFactory.CreateInstance("brunet.tcp://169.0.5.1:5000");
      FakeEdge fe = new FakeEdge(ta, ta);
      Connection fcon = new Connection(fe, addr, "structured", null, null);

      List<Connection> overlap = new List<Connection>();
      overlap.Add(fcon);
      TunnelTransportAddress tta = new TunnelTransportAddress(addr, overlap);
      TunnelEdge te1 = new TunnelEdge(null, tta, tta, new SimpleForwarderSelector(), overlap);
      Connection t1con = new Connection(te1, addr, "structured", null, null);

      overlap = new List<Connection>();
      overlap.Add(t1con);
      TunnelEdge te2 = new TunnelEdge(null, tta, tta, new SimpleForwarderSelector(), overlap);
      Connection t2con = new Connection(te2, addr, "structured", null, null);

      overlap = new List<Connection>();
      overlap.Add(t2con);
      TunnelEdge te3 = new TunnelEdge(null, tta, tta, new SimpleForwarderSelector(), overlap);
      Connection t3con = new Connection(te3, addr, "structured", null, null);

      overlap = new List<Connection>();
      overlap.Add(t3con);
      TunnelEdge te4 = new TunnelEdge(null, tta, tta, new SimpleForwarderSelector(), overlap);
      Connection t4con = new Connection(te4, addr, "structured", null, null);

      overlap = new List<Connection>();
      overlap.Add(t4con);
      TunnelEdge te5 = new TunnelEdge(null, tta, tta, new SimpleForwarderSelector(), overlap);
      Connection t5con = new Connection(te5, addr, "structured", null, null);

      Assert.AreEqual(te5.ShouldClose(), false, "Shouldn't close yet...");
      te1.DisconnectionHandler(fcon);
      Assert.AreEqual(te5.ShouldClose(), true, "Should close...");

      overlap.Add(t5con);
      overlap.Add(t3con);
      overlap.Add(t1con);
      te2.UpdateNeighborIntersection(overlap);
      Assert.AreEqual(te5.ShouldClose(), true, "Should close... 2");
    }