示例#1
0
        public RouterLink(Router router1, Router router2)
        {
            //Router1 = router1;
            //Router2 = router2;
            ////
            left  = new RouterLinkEnd(this, router1, router2.Id);
            right = new RouterLinkEnd(this, router2, router1.Id);
            //Router1.AddLinkEnd(left);
            //Router2.AddLinkEnd(right);
            ////
            //Router1.AddLink(Router2.Id, this);
            //Router2.AddLink(Router1.Id, this);
            //
            left.UpdateRoutes(router2.GetAllRoutes(), true);
            right.UpdateRoutes(router1.GetAllRoutes(), true);

            //Router1.UpdateRoutes(Router2.Id, Router2.GetAllRoutes(), true);
            //Router2.UpdateRoutes(Router1.Id, Router1.GetAllRoutes(), true);
            //// propagate to all sides
            //Router1.PropagateRoutes("");
            //Router2.PropagateRoutes("");

            left.PropagateRoutes(null);
            right.PropagateRoutes(null);
        }
示例#2
0
 public void AddLinkEnd(RouterLinkEnd linkEnd)
 {
     lock (locker)
     {
         linkEnds[linkEnd.RemoteId] = linkEnd;
         linkEnd.RegisterProcessMessage(ProcessMessage);
         UpdateRoute(linkEnd.RemoteId, linkEnd.RemoteId, 1);
     }
 }
示例#3
0
 public void PropagateRoutesExt(RouterLinkEnd linkEnd, Dictionary <string, int> allRoutes)
 {
     if (linkEnd == left)
     {
         right.UpdateRoutes(allRoutes);
     }
     else if (linkEnd == right)
     {
         left.UpdateRoutes(allRoutes);
     }
 }