Esempio n. 1
0
    //Methods:

    protected PathELManager(EdgeListener el, bool thread) {
      _el = el;
      _sync = new object();
      _edges = new List<Edge>();
      _unannounced = new Dictionary<Edge, PathEdge>();
      _pel_map = new Dictionary<string, PathEdgeListener>();
      //Use the reqrep protocol with a special prefix:
      _rrm = new ReqrepManager("PathELManager:" + el.ToString(), PType.Protocol.Pathing);
      _rrm.Subscribe(this, null);
      Rpc = new RpcManager(_rrm);
      Rpc.AddHandler("sys:pathing", this);
      _el.EdgeEvent += HandleEdge;
      _running = true;

      if(thread) {
        _timer_thread = new Thread(
          delegate() {
            int counter = 0;
            int max_counter = EDGE_PERIOD / 1000;
            while(_running) {
              Thread.Sleep(1000);
              ReqrepTimeoutChecker();
              if(++counter == max_counter) {
                counter = 0;
                EdgeTimeoutChecker();
              }
            }
          }
        );

        _timer_thread.IsBackground = true;
        _timer_thread.Start();
      }
    }
Esempio n. 2
0
 public BrunetRpc() {
   _rrm = new ReqrepManager("BrunetRpc");
   _rrm.Subscribe(this, null);
   Rpc = new RpcManager(_rrm);
   IPHandler = new IPHandler();
   IPHandler.Subscribe(this, null);
   _running = 1;
   _timer = new Thread(TimerThread);
   _timer.IsBackground = true;
   _timer.Start();
 }
Esempio n. 3
0
 public BrunetRpc()
 {
     _rrm = new ReqrepManager("BrunetRpc");
     _rrm.Subscribe(this, null);
     Rpc       = new RpcManager(_rrm);
     IPHandler = new IPHandler();
     IPHandler.Subscribe(this, null);
     _running            = 1;
     _timer              = new Thread(TimerThread);
     _timer.IsBackground = true;
     _timer.Start();
 }