コード例 #1
0
 public LeafConnectionOverlord(Node local)
 {
   _compensate = 0;
   _local = local;
   _linker = null;
   _sync = new object();
   _rnd = new Random( _local.GetHashCode()
                      ^ unchecked((int)DateTime.UtcNow.Ticks) );
   _default_retry_interval = new TimeSpan(0,0,0,0,10000);
   _current_retry_interval = new TimeSpan(0,0,0,0,10000);
   //We initialize at at year 1 to start with:
   _last_retry = DateTime.MinValue;
   _last_non_leaf_connection_event = DateTime.MinValue;
   _last_trim = DateTime.MinValue;
   /*
    * When a node is removed from the ConnectionTable,
    * we should check to see if we need to work to get a
    * replacement
    */
   lock(_sync) {
     local.ConnectionTable.DisconnectionEvent += this.CheckAndConnectHandler;
     local.ConnectionTable.ConnectionEvent += this.CheckAndConnectHandler;
     /**
      * Every heartbeat we check to see if we need to act
      */
     local.HeartBeatEvent += this.CheckAndConnectHandler;
   }
 }