Brunet.Node.StopAllEdgeListeners C# (CSharp) Метод

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

protected StopAllEdgeListeners ( ) : void
Результат void
    protected virtual void StopAllEdgeListeners()
    {
      bool changed = false;
      try {
        SetConState(Node.ConnectionState.Disconnected, out changed);
        foreach(EdgeListener el in _edgelistener_list) {
          el.Stop();
        }
        _edgelistener_list.Clear();
        Interlocked.Exchange(ref _running, 0);
        //This makes sure we don't block forever on the last packet
        _packet_queue.Enqueue(NullAction.Instance);
      }
      finally {
        if( changed ) {
          SendStateChange(Node.ConnectionState.Disconnected);
          Dictionary<EventHandler, Brunet.Util.FuzzyEvent> hbhands = null;
          lock(_sync) {
            //Get a copy of all the heartbeat events so we can stop them:
            hbhands = new Dictionary<EventHandler, Brunet.Util.FuzzyEvent>(_heartbeat_handlers);
            DemuxHandler.Clear();
          }
          foreach(KeyValuePair<EventHandler, Brunet.Util.FuzzyEvent> de in hbhands) {
            //Stop running the event
            de.Value.TryCancel();
          }
          _check_edges.TryCancel();
        }
      }
    }