Class DHTTrackerPlugin

java.lang.Object
com.biglybt.plugin.tracker.dht.DHTTrackerPlugin
All Implemented Interfaces:
AEDiagnosticsEvidenceGenerator, DownloadAttributeListener, DownloadListener, DownloadTrackerListener, Plugin

  • Field Details

    • DOWNLOAD_USER_DATA_I2P_SCRAPE_KEY

      public static Object DOWNLOAD_USER_DATA_I2P_SCRAPE_KEY
    • PLUGIN_NAME

      private static final String PLUGIN_NAME
      See Also:
    • PLUGIN_CONFIGSECTION_ID

      private static final String PLUGIN_CONFIGSECTION_ID
      See Also:
    • PLUGIN_RESOURCE_ID

      private static final String PLUGIN_RESOURCE_ID
      See Also:
    • ANNOUNCE_TIMEOUT

      private static final int ANNOUNCE_TIMEOUT
      See Also:
    • ANNOUNCE_DERIVED_TIMEOUT

      private static final int ANNOUNCE_DERIVED_TIMEOUT
      See Also:
    • ANNOUNCE_MIN_DEFAULT

      private static final int ANNOUNCE_MIN_DEFAULT
      See Also:
    • ANNOUNCE_MAX

      private static final int ANNOUNCE_MAX
      See Also:
    • ANNOUNCE_MAX_DERIVED_ONLY

      private static final int ANNOUNCE_MAX_DERIVED_ONLY
      See Also:
    • SCRAPE_DATA_KEY

      private static final Object SCRAPE_DATA_KEY
    • SCRAPE_TIMEOUT

      private static final int SCRAPE_TIMEOUT
      See Also:
    • SCRAPE_MIN_DEFAULT

      private static final int SCRAPE_MIN_DEFAULT
      See Also:
    • INTERESTING_CHECK_PERIOD

      private static final int INTERESTING_CHECK_PERIOD
      See Also:
    • INTERESTING_INIT_RAND_OURS

      private static final int INTERESTING_INIT_RAND_OURS
      See Also:
    • INTERESTING_INIT_MIN_OURS

      private static final int INTERESTING_INIT_MIN_OURS
      See Also:
    • INTERESTING_INIT_RAND_OTHERS

      private static final int INTERESTING_INIT_RAND_OTHERS
      See Also:
    • INTERESTING_INIT_MIN_OTHERS

      private static final int INTERESTING_INIT_MIN_OTHERS
      See Also:
    • INTERESTING_DHT_CHECK_PERIOD

      private static final int INTERESTING_DHT_CHECK_PERIOD
      See Also:
    • INTERESTING_DHT_INIT_RAND

      private static final int INTERESTING_DHT_INIT_RAND
      See Also:
    • INTERESTING_DHT_INIT_MIN

      private static final int INTERESTING_DHT_INIT_MIN
      See Also:
    • INTERESTING_AVAIL_MAX

      private static final int INTERESTING_AVAIL_MAX
      See Also:
    • INTERESTING_PUB_MAX_DEFAULT

      private static final int INTERESTING_PUB_MAX_DEFAULT
      See Also:
    • MAX_ACTIVE_DHT_GETS

      private static final int MAX_ACTIVE_DHT_GETS
      See Also:
    • MAX_ACTIVE_DHT_REMOVES

      private static final int MAX_ACTIVE_DHT_REMOVES
      See Also:
    • MAX_ACTIVE_DHT_PUTS

      private static final int MAX_ACTIVE_DHT_PUTS
      See Also:
    • MAX_ACTIVE_DHT_SCRAPES

      private static final int MAX_ACTIVE_DHT_SCRAPES
      See Also:
    • REG_TYPE_NONE

      private static final int REG_TYPE_NONE
      See Also:
    • REG_TYPE_FULL

      private static final int REG_TYPE_FULL
      See Also:
    • REG_TYPE_DERIVED

      private static final int REG_TYPE_DERIVED
      See Also:
    • LIMITED_TRACK_SIZE

      private static final int LIMITED_TRACK_SIZE
      See Also:
    • TRACK_NORMAL_DEFAULT

      private static final boolean TRACK_NORMAL_DEFAULT
      See Also:
    • TRACK_LIMITED_DEFAULT

      private static final boolean TRACK_LIMITED_DEFAULT
      See Also:
    • TEST_ALWAYS_TRACK

      private static final boolean TEST_ALWAYS_TRACK
      See Also:
    • NUM_WANT

      public static final int NUM_WANT
      See Also:
    • start_time

      private static final long start_time
    • DL_DERIVED_METRIC_KEY

      private static final Object DL_DERIVED_METRIC_KEY
    • DL_DERIVED_MIN_TRACK

      private static final int DL_DERIVED_MIN_TRACK
      See Also:
    • DL_DERIVED_MAX_TRACK

      private static final int DL_DERIVED_MAX_TRACK
      See Also:
    • DIRECT_INJECT_PEER_MAX

      private static final int DIRECT_INJECT_PEER_MAX
      See Also:
    • LATEST_REGISTER_REASON

      private static final Object LATEST_REGISTER_REASON
    • DEFAULT_URL

      private static URL DEFAULT_URL
    • plugin_interface

      private PluginInterface plugin_interface
    • model

      private BasicPluginViewModel model
    • dht

      private DHTPlugin dht
    • ta_networks

      private TorrentAttribute ta_networks
    • ta_peer_sources

      private TorrentAttribute ta_peer_sources
    • interesting_downloads

      private Map<Download,Long> interesting_downloads
    • interesting_published

      private Set<Download> interesting_published
    • interesting_pub_max

      private int interesting_pub_max
    • running_downloads

      private Map<Download,int[]> running_downloads
    • run_data_cache

      private Map<Download,int[]> run_data_cache
    • registered_downloads

      private Map<Download,DHTTrackerPlugin.RegistrationDetails> registered_downloads
    • limited_online_tracking

      private Map<Download,Boolean> limited_online_tracking
    • query_map

      private Map<Download,Long> query_map
    • in_progress

      private Map<Download,Integer> in_progress
    • track_only_decentralsed

      private boolean track_only_decentralsed
    • track_normal_when_offline

      private BooleanParameter track_normal_when_offline
    • track_limited_when_online

      private BooleanParameter track_limited_when_online
    • current_announce_interval

      private long current_announce_interval
    • log

      private LoggerChannel log
    • scrape_injection_map

      private Map<Download,int[]> scrape_injection_map
    • random

      private Random random
    • is_running

      private volatile boolean is_running
    • closing

      private volatile boolean closing
    • dht_gets_active

      private AtomicInteger dht_gets_active
    • dht_puts_active

      private AtomicInteger dht_puts_active
    • dht_removes_active

      private AtomicInteger dht_removes_active
    • dht_scrapes_active

      private AtomicInteger dht_scrapes_active
    • dht_scrapes_complete

      private AtomicInteger dht_scrapes_complete
    • dht_scrape_complete_mono

      private AtomicLong dht_scrape_complete_mono
    • this_mon

      private AEMonitor this_mon
    • initialised_sem

      private AESemaphore initialised_sem
    • alt_lookup_handler

      private DHTTrackerPluginAlt alt_lookup_handler
    • disable_put

      private boolean disable_put
  • Constructor Details

    • DHTTrackerPlugin

      public DHTTrackerPlugin()
  • Method Details

    • load

      public static void load(PluginInterface plugin_interface)
    • initialize

      public void initialize(PluginInterface _plugin_interface)
      Description copied from interface: Plugin
      This method is called when the Plugin is loaded by the client
      Specified by:
      initialize in interface Plugin
      Parameters:
      _plugin_interface - the interface that the plugin must use to communicate with the client
    • notRunning

      protected void notRunning()
    • initialise

      protected void initialise()
    • waitUntilInitialised

      public void waitUntilInitialised()
    • isRunning

      public boolean isRunning()
    • addDownload

      public void addDownload(Download download)
    • removeDownload

      public void removeDownload(Download download)
    • attributeEventOccurred

      public void attributeEventOccurred(Download download, TorrentAttribute attr, int event_type)
      Description copied from interface: DownloadAttributeListener
      This method will be called when an attribute event occurs.
      Specified by:
      attributeEventOccurred in interface DownloadAttributeListener
      Parameters:
      download - The download object involved.
      attr - The attribute involved.
      event_type - Either WRITTEN or WILL_BE_READ.
    • scrapeResult

      public void scrapeResult(DownloadScrapeResult result)
      Description copied from interface: DownloadTrackerListener
      A scrape result has been returned from a tracker
      Specified by:
      scrapeResult in interface DownloadTrackerListener
      Parameters:
      result - Information about the scrape
    • announceResult

      public void announceResult(DownloadAnnounceResult result)
      Description copied from interface: DownloadTrackerListener
      An announce result has been returned from the tracker
      Specified by:
      announceResult in interface DownloadTrackerListener
      Parameters:
      result - Information about the announce
    • checkDownloadForRegistration

      protected void checkDownloadForRegistration(Download download, boolean first_time)
    • processRegistrations

      protected void processRegistrations(boolean full_processing)
    • getDerivedTrackMetric

      protected long getDerivedTrackMetric(Download download)
    • trackerPut

      protected void trackerPut(Download download, DHTTrackerPlugin.RegistrationDetails details)
    • trackerGet

      protected int trackerGet(Download download, DHTTrackerPlugin.RegistrationDetails details, boolean derived_only)
    • isComplete

      protected boolean isComplete(Download download)
    • trackerRemove

      protected void trackerRemove(Download download, DHTTrackerPlugin.RegistrationDetails details)
    • trackerRemove

      protected void trackerRemove(Download download, DHTTrackerPlugin.trackerTarget target)
    • processNonRegistrations

      protected void processNonRegistrations(boolean do_presence_checks, boolean do_scrape_checks, boolean do_logging)
    • stateChanged

      public void stateChanged(Download download, int old_state, int new_state)
      Description copied from interface: DownloadListener
      The Download's state has changed. This is also triggered if the user toggles the Force Start on/off.
      Specified by:
      stateChanged in interface DownloadListener
    • announceAll

      public void announceAll()
    • announce

      private void announce(Download download)
    • generate

      public void generate(IndentWriter writer)
      Specified by:
      generate in interface AEDiagnosticsEvidenceGenerator
    • positionChanged

      public void positionChanged(Download download, int oldPosition, int newPosition)
      Description copied from interface: DownloadListener
      Position of download has changed.
      Specified by:
      positionChanged in interface DownloadListener
      Parameters:
      download - object in which the position has changed
      oldPosition - position that the download used to be at
      newPosition - position that the download is now at
    • configChanged

      protected void configChanged()
    • scrape

      public DownloadScrapeResult scrape(byte[] hash)
      This is used by the dhtscraper plugin
    • increaseActive

      protected void increaseActive(Download dl)
    • decreaseActive

      protected void decreaseActive(Download dl)
    • isActive

      protected boolean isActive(Download dl)
    • log

      private void log(Download download, String str)
    • getTrackerPeerSource

      public TrackerPeerSource getTrackerPeerSource(Download download)
    • getTrackerPeerSources

      public TrackerPeerSource[] getTrackerPeerSources(Torrent torrent)