use of com.biglybt.core.tracker.client.TRTrackerAnnouncerResponse 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();
}
}
Aggregations