org.gudy.azureus2.core3.tracker.client.impl.bt
Class TRTrackerBTAnnouncerImpl
java.lang.Object
org.gudy.azureus2.core3.tracker.client.impl.bt.TRTrackerBTAnnouncerImpl
- All Implemented Interfaces:
- TRTrackerAnnouncerHelper, TRTrackerAnnouncer
public class TRTrackerBTAnnouncerImpl
- extends Object
- implements TRTrackerAnnouncerHelper
This class handles communication with the tracker
- Author:
- Olivier
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LOGID
public static final LogIDs LOGID
tracker_timer
protected static final Timer tracker_timer
UDP_REALM
public static final String UDP_REALM
- See Also:
- Constant Field Values
tracker_state
protected int tracker_state
this_mon
protected final AEMonitor this_mon
TRTrackerBTAnnouncerImpl
public TRTrackerBTAnnouncerImpl(TOTorrent _torrent,
TOTorrentAnnounceURLSet[] _announce_urls,
String[] _peer_networks,
boolean _manual,
TRTrackerAnnouncerImpl.Helper _helper)
throws TRTrackerAnnouncerException
- Throws:
TRTrackerAnnouncerException
cloneFrom
public void cloneFrom(TRTrackerBTAnnouncerImpl other)
getAdjustedSecsToWait
protected long getAdjustedSecsToWait()
getStatus
public int getStatus()
- Specified by:
getStatus
in interface TRTrackerAnnouncer
getStatusString
public String getStatusString()
- Specified by:
getStatusString
in interface TRTrackerAnnouncer
getBestAnnouncer
public TRTrackerAnnouncer getBestAnnouncer()
- Specified by:
getBestAnnouncer
in interface TRTrackerAnnouncer
setRefreshDelayOverrides
public void setRefreshDelayOverrides(int percentage)
- Specified by:
setRefreshDelayOverrides
in interface TRTrackerAnnouncer
isUpdating
public boolean isUpdating()
- Specified by:
isUpdating
in interface TRTrackerAnnouncerHelper
getInterval
public long getInterval()
- Specified by:
getInterval
in interface TRTrackerAnnouncerHelper
getMinInterval
public long getMinInterval()
- Specified by:
getMinInterval
in interface TRTrackerAnnouncerHelper
getTimeUntilNextUpdate
public int getTimeUntilNextUpdate()
- Specified by:
getTimeUntilNextUpdate
in interface TRTrackerAnnouncerHelper
- Specified by:
getTimeUntilNextUpdate
in interface TRTrackerAnnouncer
getLastUpdateTime
public int getLastUpdateTime()
- Description copied from interface:
TRTrackerAnnouncer
- Last Update Time in seconds
- Specified by:
getLastUpdateTime
in interface TRTrackerAnnouncer
update
public void update(boolean force)
- Specified by:
update
in interface TRTrackerAnnouncer
complete
public void complete(boolean already_reported)
- Specified by:
complete
in interface TRTrackerAnnouncer
stop
public void stop(boolean for_queue)
- Specified by:
stop
in interface TRTrackerAnnouncer
requestUpdate
protected void requestUpdate()
requestUpdateSupport
protected long requestUpdateSupport()
startSupport
protected TRTrackerAnnouncerResponseImpl startSupport()
completeSupport
protected TRTrackerAnnouncerResponseImpl completeSupport()
stopSupport
protected TRTrackerAnnouncerResponseImpl stopSupport()
updateSupport
protected TRTrackerAnnouncerResponseImpl updateSupport()
announceUDP
protected String announceUDP(URL original_reqUrl,
ByteArrayOutputStream message,
boolean is_probe)
throws IOException
- Throws:
IOException
getLongURLParam
protected long getLongURLParam(String url,
String param)
getURLParam
protected String getURLParam(String url,
String param)
exceptionToString
protected String exceptionToString(Throwable e)
constructUrl
public URL constructUrl(String evt,
URL _url)
throws Exception
- Throws:
Exception
calculateNumWant
protected int calculateNumWant()
getPeerId
public byte[] getPeerId()
- Specified by:
getPeerId
in interface TRTrackerAnnouncer
setAnnounceDataProvider
public void setAnnounceDataProvider(TRTrackerAnnouncerDataProvider _provider)
- Specified by:
setAnnounceDataProvider
in interface TRTrackerAnnouncer
getTorrent
public TOTorrent getTorrent()
- Specified by:
getTorrent
in interface TRTrackerAnnouncer
getTrackerURL
public URL getTrackerURL()
- Specified by:
getTrackerURL
in interface TRTrackerAnnouncer
setTrackerURL
public void setTrackerURL(URL new_url)
- Specified by:
setTrackerURL
in interface TRTrackerAnnouncer
getAnnounceSets
public TOTorrentAnnounceURLSet[] getAnnounceSets()
- Specified by:
getAnnounceSets
in interface TRTrackerAnnouncerHelper
resetTrackerUrl
public void resetTrackerUrl(boolean shuffle)
- Specified by:
resetTrackerUrl
in interface TRTrackerAnnouncer
refreshListeners
public void refreshListeners()
- Description copied from interface:
TRTrackerAnnouncer
- This method forces all listeners to get an explicit "urlChanged" event to get them
to re-examine the tracker
- Specified by:
refreshListeners
in interface TRTrackerAnnouncer
setIPOverride
public void setIPOverride(String override)
- Specified by:
setIPOverride
in interface TRTrackerAnnouncer
clearIPOverride
public void clearIPOverride()
- Specified by:
clearIPOverride
in interface TRTrackerAnnouncer
trackerURLListToString
protected String trackerURLListToString()
decodeTrackerResponse
protected TRTrackerAnnouncerResponseImpl decodeTrackerResponse(URL url,
byte[] data)
informURLChange
protected void informURLChange(URL old_url,
URL new_url,
boolean explicit)
informURLRefresh
protected void informURLRefresh()
getLastResponse
public TRTrackerAnnouncerResponse getLastResponse()
- Specified by:
getLastResponse
in interface TRTrackerAnnouncer
isManual
public boolean isManual()
- Specified by:
isManual
in interface TRTrackerAnnouncer
destroy
public void destroy()
- Specified by:
destroy
in interface TRTrackerAnnouncer
getErrorRetryInterval
protected int getErrorRetryInterval()
- Retrieve the retry interval to use on announce errors.
setAnnounceResult
public void setAnnounceResult(DownloadAnnounceResult result)
- Specified by:
setAnnounceResult
in interface TRTrackerAnnouncer
addListener
public void addListener(TRTrackerAnnouncerListener l)
- Specified by:
addListener
in interface TRTrackerAnnouncer
removeListener
public void removeListener(TRTrackerAnnouncerListener l)
- Specified by:
removeListener
in interface TRTrackerAnnouncer
setTrackerResponseCache
public void setTrackerResponseCache(Map map)
- Description copied from interface:
TRTrackerAnnouncer
- sets the response cache. This may be used by the tracker client to return peer
details when the tracker is offline
- Specified by:
setTrackerResponseCache
in interface TRTrackerAnnouncer
removeFromTrackerResponseCache
public void removeFromTrackerResponseCache(String ip,
int tcpPort)
- Description copied from interface:
TRTrackerAnnouncer
- remove a specific entry from the cache if present
- Specified by:
removeFromTrackerResponseCache
in interface TRTrackerAnnouncer
getTrackerResponseCache
public Map getTrackerResponseCache()
- Description copied from interface:
TRTrackerAnnouncer
- returns a Map containing "bencoded" entries representing a cache of tracker
responses.
- Specified by:
getTrackerResponseCache
in interface TRTrackerAnnouncer
- Returns:
getTrackerPeerSource
public TrackerPeerSource getTrackerPeerSource(TOTorrentAnnounceURLSet set)
- Description copied from interface:
TRTrackerAnnouncer
- Gets a delegate tracker peer source for reporting against
- Specified by:
getTrackerPeerSource
in interface TRTrackerAnnouncer
- Returns:
getCacheTrackerPeerSource
public TrackerPeerSource getCacheTrackerPeerSource()
- Specified by:
getCacheTrackerPeerSource
in interface TRTrackerAnnouncer
generateEvidence
public void generateEvidence(IndentWriter writer)
- Specified by:
generateEvidence
in interface TRTrackerAnnouncer