use of com.biglybt.core.tracker.client.TRTrackerScraperClientResolver in project BiglyBT by BiglySoftware.
the class TRTrackerDHTScraperImpl method scrape.
public TRTrackerScraperResponse scrape(TOTorrent torrent, URL unused_target_url, boolean unused_force) {
if (torrent != null) {
try {
HashWrapper hw = torrent.getHashWrapper();
TRTrackerDHTScraperResponseImpl response;
synchronized (responses) {
response = responses.get(hw);
}
if (response == null) {
TRTrackerScraperClientResolver resolver = scraper.getClientResolver();
if (resolver != null) {
int[] cache = resolver.getCachedScrape(hw);
if (cache != null) {
response = new TRTrackerDHTScraperResponseImpl(hw, torrent.getAnnounceURL());
response.setSeedsPeers(cache[0], cache[1]);
long now = SystemTime.getCurrentTime();
response.setScrapeStartTime(now);
response.setNextScrapeStartTime(now + 5 * 60 * 1000);
response.setStatus(TRTrackerScraperResponse.ST_ONLINE, MessageText.getString("Scrape.status.cached"));
synchronized (responses) {
responses.put(torrent.getHashWrapper(), response);
}
scraper.scrapeReceived(response);
}
}
}
return (response);
} catch (TOTorrentException e) {
Debug.printStackTrace(e);
}
}
return (null);
}
Aggregations