com.aelitis.azureus.plugins.tracker.dht
Class DHTTrackerPlugin

java.lang.Object
  extended by com.aelitis.azureus.plugins.tracker.dht.DHTTrackerPlugin
All Implemented Interfaces:
DownloadAttributeListener, DownloadListener, DownloadTrackerListener, Plugin

public class DHTTrackerPlugin
extends java.lang.Object
implements Plugin, DownloadListener, DownloadAttributeListener, DownloadTrackerListener

Author:
parg

Nested Class Summary
protected static class DHTTrackerPlugin.putDetails
           
protected  class DHTTrackerPlugin.RegistrationDetails
           
static class DHTTrackerPlugin.trackerTarget
           
static class DHTTrackerPlugin.TriangleSlicer
           
 
Field Summary
static java.lang.Object DOWNLOAD_USER_DATA_I2P_SCRAPE_KEY
           
static int NUM_WANT
           
 
Fields inherited from interface org.gudy.azureus2.plugins.download.DownloadAttributeListener
WILL_BE_READ, WRITTEN
 
Constructor Summary
DHTTrackerPlugin()
           
 
Method Summary
 void addDownload(Download download)
           
 void announceAll()
           
 void announceResult(DownloadAnnounceResult result)
          An announce result has been returned from the tracker
 void 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 Azureus
protected  boolean isActive(Download dl)
           
protected  boolean isComplete(Download download)
           
 boolean isRunning()
           
static void load(PluginInterface plugin_interface)
           
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 plugin
 void scrapeResult(DownloadScrapeResult result)
          A scrape result has been returned from a tracker
 void 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
 

Field Detail

DOWNLOAD_USER_DATA_I2P_SCRAPE_KEY

public static java.lang.Object DOWNLOAD_USER_DATA_I2P_SCRAPE_KEY

NUM_WANT

public static final int NUM_WANT
See Also:
Constant Field Values
Constructor Detail

DHTTrackerPlugin

public DHTTrackerPlugin()
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 Azureus

Specified by:
initialize in interface Plugin
Parameters:
_plugin_interface - the interface that the plugin must use to communicate with Azureus

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()

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()

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)

getTrackerPeerSource

public TrackerPeerSource getTrackerPeerSource(Download download)

getTrackerPeerSources

public TrackerPeerSource[] getTrackerPeerSources(Torrent torrent)