void DhtEngineStateChanged(object o, EventArgs e) { if (DhtEngine.State != DhtState.Ready) { return; } MainLoop.Queue(delegate { foreach (TorrentManager manager in torrents) { if (!manager.CanUseDht) { continue; } DhtEngine.AnnounceAsync(manager.InfoHash, Listener.Endpoint.Port); DhtEngine.GetPeersAsync(manager.InfoHash); } }); }