Example #1
0
        public void RegisterDht(IDhtEngine engine)
        {
            MainLoop.QueueWait(() =>
                                   {
                                       if (dhtEngine != null)
                                       {
                                           dhtEngine.StateChanged -= DhtEngineStateChanged;
                                           dhtEngine.Stop();
                                           dhtEngine.Dispose();
                                       }
                                       dhtEngine = engine ?? new NullDhtEngine();
                                   });

            dhtEngine.StateChanged += DhtEngineStateChanged;
        }
        public void RegisterDht(IDhtEngine engine)
        {
            MainLoop.QueueWait(delegate
            {
                if (DhtEngine != null)
                {
                    DhtEngine.StateChanged -= DhtEngineStateChanged;
                    DhtEngine.Stop();
                    DhtEngine.Dispose();
                }
                DhtEngine = engine ?? new NullDhtEngine();
            });

            DhtEngine.StateChanged += DhtEngineStateChanged;
        }