Class TRTrackerBTAnnouncerImpl
java.lang.Object
com.biglybt.core.tracker.client.impl.bt.TRTrackerBTAnnouncerImpl
- All Implemented Interfaces:
TRTrackerAnnouncerHelper
,TRTrackerAnnouncer
This class handles communication with the tracker
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final AllTrackersManager.AllTrackers
private TRTrackerAnnouncerDataProvider
private final TOTorrentAnnounceURLSet[]
private int
private int
private byte
private int
private boolean
private static final AEMonitor
private boolean
private boolean
private long
private TimerEvent
private byte[]
private boolean
private boolean
private final int
private boolean
private int
private long
private TRTrackerAnnouncerImpl.Helper
private String
private boolean
private String
private TRTrackerAnnouncerResponseImpl
private String
private long
private URL
private URL
static final LogIDs
private final boolean
private long
private long
private static final int
private final String[]
private long
private int
private boolean
private boolean
private static boolean
protected final AEMonitor
private TimerEventPerformer
private final TOTorrent
private final HashWrapper
private final HashWrapper
private String
private long
private long
private byte[]
private String
private static final Map
protected int
private String
private final Timer
private static final Timer
private static final Timer
static final String
private static boolean
private static boolean
private boolean
private static int
private static int
private InetSocketAddress
Fields inherited from interface com.biglybt.core.tracker.client.TRTrackerAnnouncer
AZ_TRACKER_VERSION_1, AZ_TRACKER_VERSION_2, AZ_TRACKER_VERSION_3, AZ_TRACKER_VERSION_CURRENT, DEFAULT_PEERS_TO_CACHE, REFRESH_MINIMUM_SECS, TS_COMPLETED, TS_DOWNLOADING, TS_INITIALISED, TS_STOPPED
-
Constructor Summary
ConstructorsConstructorDescriptionTRTrackerBTAnnouncerImpl
(HashWrapper _torrent_hash_override, TOTorrent _torrent, TOTorrentAnnounceURLSet[] _announce_urls, String[] _peer_networks, boolean _manual, TRTrackerAnnouncerImpl.Helper _helper) -
Method Summary
Modifier and TypeMethodDescriptionvoid
(package private) static void
(package private) static void
analyseTimerEvents
(Timer timer) private String
announceHTTP
(URL[] tracker_url, URL original_reqUrl, ByteArrayOutputStream message, boolean first_effort) private String
announceHTTPSupport
(URL[] tracker_url, URL original_reqUrl, Proxy proxy, boolean first_effort, ByteArrayOutputStream message) protected String
announceUDP
(URL original_reqUrl, ByteArrayOutputStream message, boolean is_probe) protected int
void
void
void
complete
(boolean already_reported) protected TRTrackerAnnouncerResponseImpl
completeSupport
(TimerEvent timer_event) private TRTrackerAnnouncerRequestImpl
constructRequest
(String evt, URL _url, TimerEvent timer_event) private void
constructTrackerUrlLists
(boolean shuffle) protected TRTrackerAnnouncerResponseImpl
decodeTrackerResponse
(URL url, byte[] data) void
destroy()
protected String
protected String
void
generateEvidence
(IndentWriter writer) protected long
protected int
Retrieve the retry interval to use on announce errors.long
int
Last Update Time in secondsprivate Long
protected long
getLongURLParam
(String url, String param) long
byte[]
int
int
Gets a delegate tracker peer source for reporting againstreturns a Map containing "bencoded" entries representing a cache of tracker responses.protected String
getURLParam
(String url, String param) protected void
informURLChange
(URL old_url, URL new_url, boolean explicit) protected void
boolean
isManual()
boolean
void
This method forces all listeners to get an explicit "urlChanged" event to get them to re-examine the trackervoid
removeFromTrackerResponseCache
(String ip, int tcpPort) remove a specific entry from the cache if presentvoid
protected void
protected long
requestUpdateSupport
(TimerEvent timer_event) void
resetTrackerUrl
(boolean shuffle) void
void
void
setIPOverride
(String override) void
setRefreshDelayOverrides
(int percentage) void
sets the response cache.void
setTrackerURL
(URL new_url) protected TRTrackerAnnouncerResponseImpl
startSupport
(TimerEvent timer_event) void
stop
(boolean for_queue) protected TRTrackerAnnouncerResponseImpl
stopSupport
(TimerEvent timer_event) protected String
void
update
(boolean force) private TRTrackerAnnouncerResponseImpl
update
(String evt, TimerEvent timer_event) private TRTrackerAnnouncerResponseImpl
update2
(String evt, TimerEvent timer_event) private TRTrackerAnnouncerResponseImpl
update2Support
(String evt, TimerEvent event) private byte[]
protected TRTrackerAnnouncerResponseImpl
updateSupport
(TimerEvent timer_event)
-
Field Details
-
LOGID
-
OVERRIDE_PERIOD
private static final int OVERRIDE_PERIOD- See Also:
-
tracker_timer_public
-
tracker_timer_private
-
all_trackers
-
UDP_REALM
- See Also:
-
userMinInterval
private static int userMinInterval -
userMaxNumwant
private static int userMaxNumwant -
tcpAnnounceEnabled
private static boolean tcpAnnounceEnabled -
udpAnnounceEnabled
private static boolean udpAnnounceEnabled -
udpProbeEnabled
private static boolean udpProbeEnabled -
class_mon
-
tracker_report_map
-
tracker_timer
-
torrent
-
announce_urls
-
helper
-
current_timer_event
-
timer_event_action
-
tracker_state
protected int tracker_state -
tracker_status_str
-
last_response
-
last_update_time_secs
private long last_update_time_secs -
current_time_to_wait_secs
private long current_time_to_wait_secs -
manual_control
private final boolean manual_control -
dispersal_random
private final int dispersal_random -
tracker_interval
private long tracker_interval -
tracker_min_interval
private long tracker_min_interval -
min_interval
private long min_interval -
failure_added_time
private int failure_added_time -
failure_time_last_updated
private long failure_time_last_updated -
stopped
private boolean stopped -
stopped_for_queue
private boolean stopped_for_queue -
completed
private boolean completed -
complete_reported
private boolean complete_reported -
update_in_progress
private boolean update_in_progress -
rd_last_override
private long rd_last_override -
rd_override_percentage
private int rd_override_percentage -
min_interval_override
private long min_interval_override -
trackerUrlLists
-
lastUsedUrl
-
lastAZTrackerCheckedURL
-
torrent_hash_actual
-
torrent_hash_target
-
last_tracker_message
-
info_hash
-
tracker_peer_id
private byte[] tracker_peer_id -
tracker_peer_id_str
-
data_peer_id
private byte[] data_peer_id -
announceCount
private int announceCount -
announceFailCount
private int announceFailCount -
autoUDPprobeEvery
private byte autoUDPprobeEvery -
autoUDPProbeSuccessCount
private int autoUDPProbeSuccessCount -
working_udp_ia
-
tracker_id
-
ip_override
-
peer_networks
-
announce_data_provider
-
this_mon
-
az_tracker
private boolean az_tracker -
enable_sni_hack
private boolean enable_sni_hack -
internal_error_hack
private boolean internal_error_hack -
dh_hack
private boolean dh_hack -
destroyed
private boolean destroyed
-
-
Constructor Details
-
TRTrackerBTAnnouncerImpl
public TRTrackerBTAnnouncerImpl(HashWrapper _torrent_hash_override, TOTorrent _torrent, TOTorrentAnnounceURLSet[] _announce_urls, String[] _peer_networks, boolean _manual, TRTrackerAnnouncerImpl.Helper _helper) throws TRTrackerAnnouncerException - Throws:
TRTrackerAnnouncerException
-
-
Method Details
-
analyseTimerEvents
static void analyseTimerEvents() -
analyseTimerEvents
-
cloneFrom
-
getAdjustedSecsToWait
protected long getAdjustedSecsToWait() -
getStatus
public int getStatus()- Specified by:
getStatus
in interfaceTRTrackerAnnouncer
-
getStatusString
- Specified by:
getStatusString
in interfaceTRTrackerAnnouncer
-
getBestAnnouncer
- Specified by:
getBestAnnouncer
in interfaceTRTrackerAnnouncer
-
setRefreshDelayOverrides
public void setRefreshDelayOverrides(int percentage) - Specified by:
setRefreshDelayOverrides
in interfaceTRTrackerAnnouncer
-
isUpdating
public boolean isUpdating()- Specified by:
isUpdating
in interfaceTRTrackerAnnouncerHelper
-
getInterval
public long getInterval()- Specified by:
getInterval
in interfaceTRTrackerAnnouncerHelper
-
getMinInterval
public long getMinInterval()- Specified by:
getMinInterval
in interfaceTRTrackerAnnouncerHelper
-
getTimeUntilNextUpdate
public int getTimeUntilNextUpdate()- Specified by:
getTimeUntilNextUpdate
in interfaceTRTrackerAnnouncer
- Specified by:
getTimeUntilNextUpdate
in interfaceTRTrackerAnnouncerHelper
-
getLastUpdateTime
public int getLastUpdateTime()Description copied from interface:TRTrackerAnnouncer
Last Update Time in seconds- Specified by:
getLastUpdateTime
in interfaceTRTrackerAnnouncer
-
update
public void update(boolean force) - Specified by:
update
in interfaceTRTrackerAnnouncer
-
complete
public void complete(boolean already_reported) - Specified by:
complete
in interfaceTRTrackerAnnouncer
-
stop
public void stop(boolean for_queue) - Specified by:
stop
in interfaceTRTrackerAnnouncer
-
requestUpdate
protected void requestUpdate() -
requestUpdateSupport
-
startSupport
-
completeSupport
-
stopSupport
-
updateSupport
-
update
-
update2
-
update2Support
-
updateOld
- Throws:
Exception
-
announceHTTP
private String announceHTTP(URL[] tracker_url, URL original_reqUrl, ByteArrayOutputStream message, boolean first_effort) throws Exception - Throws:
Exception
-
announceHTTPSupport
private String announceHTTPSupport(URL[] tracker_url, URL original_reqUrl, Proxy proxy, boolean first_effort, ByteArrayOutputStream message) throws IOException - Throws:
IOException
-
announceUDP
-
getLongURLParam
-
getURLParam
-
exceptionToString
-
exceptionToString
-
constructRequest
private TRTrackerAnnouncerRequestImpl constructRequest(String evt, URL _url, TimerEvent timer_event) throws Exception - Throws:
Exception
-
calculateNumWant
protected int calculateNumWant() -
getPeerId
public byte[] getPeerId()- Specified by:
getPeerId
in interfaceTRTrackerAnnouncer
-
setAnnounceDataProvider
- Specified by:
setAnnounceDataProvider
in interfaceTRTrackerAnnouncer
-
getTorrent
- Specified by:
getTorrent
in interfaceTRTrackerAnnouncer
-
getTrackerURL
- Specified by:
getTrackerURL
in interfaceTRTrackerAnnouncer
-
setTrackerURL
- Specified by:
setTrackerURL
in interfaceTRTrackerAnnouncer
-
getAnnounceSets
- Specified by:
getAnnounceSets
in interfaceTRTrackerAnnouncerHelper
-
resetTrackerUrl
public void resetTrackerUrl(boolean shuffle) - Specified by:
resetTrackerUrl
in interfaceTRTrackerAnnouncer
-
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 interfaceTRTrackerAnnouncer
-
setIPOverride
- Specified by:
setIPOverride
in interfaceTRTrackerAnnouncer
-
clearIPOverride
public void clearIPOverride()- Specified by:
clearIPOverride
in interfaceTRTrackerAnnouncer
-
constructTrackerUrlLists
private void constructTrackerUrlLists(boolean shuffle) -
trackerURLListToString
-
decodeTrackerResponse
-
getLong
-
informURLChange
-
informURLRefresh
protected void informURLRefresh() -
getLastResponse
- Specified by:
getLastResponse
in interfaceTRTrackerAnnouncer
-
isManual
public boolean isManual()- Specified by:
isManual
in interfaceTRTrackerAnnouncer
-
destroy
public void destroy()- Specified by:
destroy
in interfaceTRTrackerAnnouncer
-
getErrorRetryInterval
protected int getErrorRetryInterval()Retrieve the retry interval to use on announce errors. -
setAnnounceResult
- Specified by:
setAnnounceResult
in interfaceTRTrackerAnnouncer
-
addListener
- Specified by:
addListener
in interfaceTRTrackerAnnouncer
-
removeListener
- Specified by:
removeListener
in interfaceTRTrackerAnnouncer
-
setTrackerResponseCache
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 interfaceTRTrackerAnnouncer
- Parameters:
map
-
-
removeFromTrackerResponseCache
Description copied from interface:TRTrackerAnnouncer
remove a specific entry from the cache if present- Specified by:
removeFromTrackerResponseCache
in interfaceTRTrackerAnnouncer
- Parameters:
ip
-tcpPort
-
-
getTrackerResponseCache
Description copied from interface:TRTrackerAnnouncer
returns a Map containing "bencoded" entries representing a cache of tracker responses.- Specified by:
getTrackerResponseCache
in interfaceTRTrackerAnnouncer
- Returns:
-
getTrackerPeerSource
Description copied from interface:TRTrackerAnnouncer
Gets a delegate tracker peer source for reporting against- Specified by:
getTrackerPeerSource
in interfaceTRTrackerAnnouncer
- Parameters:
set
-- Returns:
-
getCacheTrackerPeerSource
- Specified by:
getCacheTrackerPeerSource
in interfaceTRTrackerAnnouncer
-
generateEvidence
- Specified by:
generateEvidence
in interfaceTRTrackerAnnouncer
-