Ejemplo n.º 1
0
        public void Dispose()
        {
            if (disposed)
            {
                return;
            }

            disposed = true;
            MainLoop.QueueWait(() =>
            {
                dhtEngine.Dispose();
                diskManager.Dispose();
                listenManager.Dispose();
                localPeerListener.Stop();
                localPeerManager.Dispose();
                MainLoop.Dispose();
            });
        }
Ejemplo n.º 2
0
        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;
        }