Package com.biglybt.plugin.tracker.dht
Class DHTTrackerPlugin
- java.lang.Object
-
- com.biglybt.plugin.tracker.dht.DHTTrackerPlugin
-
- All Implemented Interfaces:
DownloadAttributeListener
,DownloadListener
,DownloadTrackerListener
,Plugin
public class DHTTrackerPlugin extends java.lang.Object implements Plugin, DownloadListener, DownloadAttributeListener, DownloadTrackerListener
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
DHTTrackerPlugin.putDetails
protected class
DHTTrackerPlugin.RegistrationDetails
static class
DHTTrackerPlugin.trackerTarget
static class
DHTTrackerPlugin.TriangleSlicer
-
Field Summary
-
Fields inherited from interface com.biglybt.pif.download.DownloadAttributeListener
WILL_BE_READ, WRITTEN
-
-
Constructor Summary
Constructors Constructor Description DHTTrackerPlugin()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addDownload(Download download)
private void
announce(Download download)
void
announceAll()
void
announceResult(DownloadAnnounceResult result)
An announce result has been returned from the trackervoid
attributeEventOccurred(Download download, TorrentAttribute attr, int event_type)
This method will be called when an attribute event occurs.protected void
checkDownloadForRegistration(Download download, boolean first_time)
protected void
configChanged()
protected void
decreaseActive(Download dl)
protected long
getDerivedTrackMetric(Download download)
TrackerPeerSource
getTrackerPeerSource(Download download)
TrackerPeerSource[]
getTrackerPeerSources(Torrent torrent)
protected void
increaseActive(Download dl)
protected void
initialise()
void
initialize(PluginInterface _plugin_interface)
This method is called when the Plugin is loaded by the clientprotected boolean
isActive(Download dl)
protected boolean
isComplete(Download download)
boolean
isRunning()
static void
load(PluginInterface plugin_interface)
private void
log(Download download, java.lang.String str)
protected void
notRunning()
void
positionChanged(Download download, int oldPosition, int newPosition)
Position of download has changed.protected void
processNonRegistrations()
protected void
processRegistrations(boolean full_processing)
void
removeDownload(Download download)
DownloadScrapeResult
scrape(byte[] hash)
This is used by the dhtscraper pluginvoid
scrapeResult(DownloadScrapeResult result)
A scrape result has been returned from a trackervoid
stateChanged(Download download, int old_state, int new_state)
The Download's state has changed.protected int
trackerGet(Download download, DHTTrackerPlugin.RegistrationDetails details, boolean derived_only)
protected void
trackerPut(Download download, DHTTrackerPlugin.RegistrationDetails details)
protected void
trackerRemove(Download download, DHTTrackerPlugin.RegistrationDetails details)
protected void
trackerRemove(Download download, DHTTrackerPlugin.trackerTarget target)
void
waitUntilInitialised()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.biglybt.pif.Plugin
getInitialProperties
-
-
-
-
Field Detail
-
DOWNLOAD_USER_DATA_I2P_SCRAPE_KEY
public static java.lang.Object DOWNLOAD_USER_DATA_I2P_SCRAPE_KEY
-
PLUGIN_NAME
private static final java.lang.String PLUGIN_NAME
- See Also:
- Constant Field Values
-
PLUGIN_CONFIGSECTION_ID
private static final java.lang.String PLUGIN_CONFIGSECTION_ID
- See Also:
- Constant Field Values
-
PLUGIN_RESOURCE_ID
private static final java.lang.String PLUGIN_RESOURCE_ID
- See Also:
- Constant Field Values
-
ANNOUNCE_TIMEOUT
private static final int ANNOUNCE_TIMEOUT
- See Also:
- Constant Field Values
-
ANNOUNCE_DERIVED_TIMEOUT
private static final int ANNOUNCE_DERIVED_TIMEOUT
- See Also:
- Constant Field Values
-
SCRAPE_TIMEOUT
private static final int SCRAPE_TIMEOUT
- See Also:
- Constant Field Values
-
ANNOUNCE_MIN_DEFAULT
private static final int ANNOUNCE_MIN_DEFAULT
- See Also:
- Constant Field Values
-
ANNOUNCE_MAX
private static final int ANNOUNCE_MAX
- See Also:
- Constant Field Values
-
ANNOUNCE_MAX_DERIVED_ONLY
private static final int ANNOUNCE_MAX_DERIVED_ONLY
- See Also:
- Constant Field Values
-
INTERESTING_CHECK_PERIOD
private static final int INTERESTING_CHECK_PERIOD
- See Also:
- Constant Field Values
-
INTERESTING_INIT_RAND_OURS
private static final int INTERESTING_INIT_RAND_OURS
- See Also:
- Constant Field Values
-
INTERESTING_INIT_MIN_OURS
private static final int INTERESTING_INIT_MIN_OURS
- See Also:
- Constant Field Values
-
INTERESTING_INIT_RAND_OTHERS
private static final int INTERESTING_INIT_RAND_OTHERS
- See Also:
- Constant Field Values
-
INTERESTING_INIT_MIN_OTHERS
private static final int INTERESTING_INIT_MIN_OTHERS
- See Also:
- Constant Field Values
-
INTERESTING_DHT_CHECK_PERIOD
private static final int INTERESTING_DHT_CHECK_PERIOD
- See Also:
- Constant Field Values
-
INTERESTING_DHT_INIT_RAND
private static final int INTERESTING_DHT_INIT_RAND
- See Also:
- Constant Field Values
-
INTERESTING_DHT_INIT_MIN
private static final int INTERESTING_DHT_INIT_MIN
- See Also:
- Constant Field Values
-
INTERESTING_AVAIL_MAX
private static final int INTERESTING_AVAIL_MAX
- See Also:
- Constant Field Values
-
INTERESTING_PUB_MAX_DEFAULT
private static final int INTERESTING_PUB_MAX_DEFAULT
- See Also:
- Constant Field Values
-
REG_TYPE_NONE
private static final int REG_TYPE_NONE
- See Also:
- Constant Field Values
-
REG_TYPE_FULL
private static final int REG_TYPE_FULL
- See Also:
- Constant Field Values
-
REG_TYPE_DERIVED
private static final int REG_TYPE_DERIVED
- See Also:
- Constant Field Values
-
LIMITED_TRACK_SIZE
private static final int LIMITED_TRACK_SIZE
- See Also:
- Constant Field Values
-
TRACK_NORMAL_DEFAULT
private static final boolean TRACK_NORMAL_DEFAULT
- See Also:
- Constant Field Values
-
TRACK_LIMITED_DEFAULT
private static final boolean TRACK_LIMITED_DEFAULT
- See Also:
- Constant Field Values
-
TEST_ALWAYS_TRACK
private static final boolean TEST_ALWAYS_TRACK
- See Also:
- Constant Field Values
-
NUM_WANT
public static final int NUM_WANT
- See Also:
- Constant Field Values
-
start_time
private static final long start_time
-
DL_DERIVED_METRIC_KEY
private static final java.lang.Object DL_DERIVED_METRIC_KEY
-
DL_DERIVED_MIN_TRACK
private static final int DL_DERIVED_MIN_TRACK
- See Also:
- Constant Field Values
-
DL_DERIVED_MAX_TRACK
private static final int DL_DERIVED_MAX_TRACK
- See Also:
- Constant Field Values
-
DIRECT_INJECT_PEER_MAX
private static final int DIRECT_INJECT_PEER_MAX
- See Also:
- Constant Field Values
-
DEFAULT_URL
private static java.net.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 java.util.Map<Download,java.lang.Long> interesting_downloads
-
interesting_published
private int interesting_published
-
interesting_pub_max
private int interesting_pub_max
-
running_downloads
private java.util.Map<Download,int[]> running_downloads
-
run_data_cache
private java.util.Map<Download,int[]> run_data_cache
-
registered_downloads
private java.util.Map<Download,DHTTrackerPlugin.RegistrationDetails> registered_downloads
-
limited_online_tracking
private java.util.Map<Download,java.lang.Boolean> limited_online_tracking
-
query_map
private java.util.Map<Download,java.lang.Long> query_map
-
in_progress
private java.util.Map<Download,java.lang.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 java.util.Map<Download,int[]> scrape_injection_map
-
random
private java.util.Random random
-
is_running
private boolean is_running
-
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
-
-
Method Detail
-
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 interfacePlugin
- 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 interfaceDownloadAttributeListener
- 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 interfaceDownloadTrackerListener
- 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 interfaceDownloadTrackerListener
- 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()
-
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 interfaceDownloadListener
-
announceAll
public void announceAll()
-
announce
private void announce(Download download)
-
positionChanged
public void positionChanged(Download download, int oldPosition, int newPosition)
Description copied from interface:DownloadListener
Position of download has changed.- Specified by:
positionChanged
in interfaceDownloadListener
- Parameters:
download
- object in which the position has changedoldPosition
- position that the download used to be atnewPosition
- 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, java.lang.String str)
-
getTrackerPeerSource
public TrackerPeerSource getTrackerPeerSource(Download download)
-
getTrackerPeerSources
public TrackerPeerSource[] getTrackerPeerSources(Torrent torrent)
-
-