Search in sources :

Example 1 with TRTrackerDHTAnnouncerImpl

use of com.biglybt.core.tracker.client.impl.dht.TRTrackerDHTAnnouncerImpl in project BiglyBT by BiglySoftware.

the class TRTrackerAnnouncerMuxer method create.

private TRTrackerAnnouncerHelper create(TOTorrent torrent, String[] networks, TOTorrentAnnounceURLSet[] sets) throws TRTrackerAnnouncerException {
    TRTrackerAnnouncerHelper announcer;
    boolean decentralised;
    if (sets.length == 0) {
        decentralised = TorrentUtils.isDecentralised(torrent.getAnnounceURL());
    } else {
        decentralised = TorrentUtils.isDecentralised(sets[0].getAnnounceURLs()[0]);
    }
    if (decentralised) {
        announcer = new TRTrackerDHTAnnouncerImpl(torrent, networks, is_manual, getHelper());
    } else {
        announcer = new TRTrackerBTAnnouncerImpl(torrent, sets, networks, is_manual, getHelper());
    }
    for (TOTorrentAnnounceURLSet set : sets) {
        URL[] urls = set.getAnnounceURLs();
        for (URL u : urls) {
            String key = u.toExternalForm();
            StatusSummary summary = recent_responses.get(key);
            if (summary == null) {
                summary = new StatusSummary(announcer, u);
                recent_responses.put(key, summary);
            } else {
                summary.setHelper(announcer);
            }
        }
    }
    if (provider != null) {
        announcer.setAnnounceDataProvider(provider);
    }
    if (ip_override != null) {
        announcer.setIPOverride(ip_override);
    }
    return (announcer);
}
Also used : TRTrackerBTAnnouncerImpl(com.biglybt.core.tracker.client.impl.bt.TRTrackerBTAnnouncerImpl) TRTrackerDHTAnnouncerImpl(com.biglybt.core.tracker.client.impl.dht.TRTrackerDHTAnnouncerImpl) TOTorrentAnnounceURLSet(com.biglybt.core.torrent.TOTorrentAnnounceURLSet) URL(java.net.URL)

Aggregations

TOTorrentAnnounceURLSet (com.biglybt.core.torrent.TOTorrentAnnounceURLSet)1 TRTrackerBTAnnouncerImpl (com.biglybt.core.tracker.client.impl.bt.TRTrackerBTAnnouncerImpl)1 TRTrackerDHTAnnouncerImpl (com.biglybt.core.tracker.client.impl.dht.TRTrackerDHTAnnouncerImpl)1 URL (java.net.URL)1