use of com.biglybt.plugin.tracker.dht.DHTTrackerPlugin in project BiglyBT by BiglySoftware.
the class CoreImpl method announceAll.
protected void announceAll(boolean force) {
Logger.log(new LogEvent(LOGID, "Updating trackers"));
GlobalManager gm = getGlobalManager();
if (gm != null) {
List downloads = gm.getDownloadManagers();
long now = SystemTime.getCurrentTime();
for (int i = 0; i < downloads.size(); i++) {
DownloadManager dm = (DownloadManager) downloads.get(i);
Long last_announce_l = (Long) dm.getUserData(DM_ANNOUNCE_KEY);
long last_announce = last_announce_l == null ? create_time : last_announce_l.longValue();
TRTrackerAnnouncer an = dm.getTrackerClient();
if (an != null) {
TRTrackerAnnouncerResponse last_announce_response = an.getLastResponse();
if (now - last_announce > 15 * 60 * 1000 || last_announce_response == null || last_announce_response.getStatus() == TRTrackerAnnouncerResponse.ST_OFFLINE || force) {
dm.setUserData(DM_ANNOUNCE_KEY, new Long(now));
Logger.log(new LogEvent(LOGID, " updating tracker for " + dm.getDisplayName()));
dm.requestTrackerAnnounce(true);
}
}
}
}
PluginInterface dht_tracker_pi = getPluginManager().getPluginInterfaceByClass(DHTTrackerPlugin.class);
if (dht_tracker_pi != null) {
((DHTTrackerPlugin) dht_tracker_pi.getPlugin()).announceAll();
}
}
use of com.biglybt.plugin.tracker.dht.DHTTrackerPlugin in project BiglyBT by BiglySoftware.
the class LightWeightSeedManager method startUp.
protected void startUp() {
synchronized (this) {
if (started) {
return;
}
started = true;
}
boolean release_now = true;
try {
final PluginManager plugin_manager = CoreFactory.getSingleton().getPluginManager();
PluginInterface pi = plugin_manager.getPluginInterfaceByClass(DHTTrackerPlugin.class);
if (pi != null) {
final DHTTrackerPlugin plugin = (DHTTrackerPlugin) pi.getPlugin();
new AEThread2("LWS:waitForPlug", true) {
@Override
public void run() {
try {
plugin.waitUntilInitialised();
if (plugin.isRunning()) {
tttorrent = DDBaseImpl.getSingleton(CoreFactory.getSingleton()).getTTTorrent();
}
Set<LWSDownload> to_add;
try {
PluginInterface anon_pi = plugin_manager.getPluginInterfaceByID("azneti2phelper");
if (anon_pi != null) {
anon_dht_tracker_plugin = anon_pi.getIPC();
}
} catch (Throwable e) {
Debug.out(e);
}
synchronized (this) {
public_dht_tracker_plugin = plugin;
to_add = new HashSet<>(dht_add_queue);
dht_add_queue.clear();
}
Iterator<LWSDownload> it = to_add.iterator();
while (it.hasNext()) {
addDownload(it.next());
}
} finally {
init_sem.releaseForever();
}
}
}.start();
release_now = false;
} else {
synchronized (dht_add_queue) {
borked = true;
dht_add_queue.clear();
}
}
} finally {
if (release_now) {
init_sem.releaseForever();
}
}
}
Aggregations