Brunet.Services.Dht.DhtDiscovery.SeekTAs C# (CSharp) Метод

SeekTAs() защищенный Метод

protected SeekTAs ( System.DateTime now ) : void
now System.DateTime
Результат void
    override protected void SeekTAs(DateTime now)
    {
      if(Interlocked.Exchange(ref _ongoing, 1) == 1) {
        return;
      }

      Channel chan = new Channel();

      EventHandler handler = delegate(object o, EventArgs ea) {
        if(!chan.Closed && chan.Count < 8) {
          return;
        }

        List<TransportAddress> tas = new List<TransportAddress>();
        while(chan.Count > 0) {
          AHAddress addr = null;
          try {
            IDictionary dict = (IDictionary) chan.Dequeue();
            byte[] baddr = (byte[]) dict["value"];
            addr = new AHAddress(MemBlock.Reference(baddr));
          } catch {
            continue;
          }
          tas.Add(new SubringTransportAddress(addr, _shared_namespace));
        }

        if(tas.Count > 0) {
          CheckAndUpdateRemoteTAs(tas);
        }

        if(chan.Closed) {
          Interlocked.Exchange(ref _ongoing, 0);
        }
      };

      if(_steady_state == 0) {
        chan.EnqueueEvent += handler;
      }
      chan.CloseEvent += handler;

      try {
        _dht.AsyncGet(_private_dht_key, chan);
      } catch(DhtException) {
        chan.Close();
      }
    }