public void Dispose() { if (disposed) { return; } disposed = true; MainLoop.QueueWait(() => { dhtEngine.Dispose(); diskManager.Dispose(); listenManager.Dispose(); localPeerListener.Stop(); localPeerManager.Dispose(); MainLoop.Dispose(); }); }
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; }