Class TRTrackerServerPeerImpl
java.lang.Object
com.biglybt.core.tracker.server.impl.TRTrackerServerPeerImpl
- All Implemented Interfaces:
TRTrackerServerNatCheckerListener, TRTrackerServerSimplePeer, TRTrackerServerPeer, TRTrackerServerPeerBase, HostNameToIPResolverListener
public class TRTrackerServerPeerImpl
extends Object
implements TRTrackerServerPeer, TRTrackerServerSimplePeer, HostNameToIPResolverListener, TRTrackerServerNatCheckerListener
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate longprivate byteprivate booleanprivate byteprivate booleanprivate longprivate shortprivate byte[]private byte[]private final booleanprivate Stringprivate final intprivate longprivate byteprivate DHTNetworkPositionprivate final HashWrapperprivate shortprivate longprivate shortprivate shortprivate longprivate ObjectFields inherited from interface TRTrackerServerPeer
CRYPTO_NONE, CRYPTO_REQUIRED, CRYPTO_SUPPORTED, NAT_CHECK_DISABLED, NAT_CHECK_FAILED, NAT_CHECK_FAILED_AND_REPORTED, NAT_CHECK_INITIATED, NAT_CHECK_OK, NAT_CHECK_UNKNOWN -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedTRTrackerServerPeerImpl(HashWrapper _peer_id, int _key_hash_code, byte[] _ip, boolean _ip_override, int _tcp_port, int _udp_port, int _http_port, byte _crypto_level, byte _az_ver, long _last_contact_time, boolean _download_completed, byte _last_nat_status, int _up_speed, DHTNetworkPosition _network_position) protectedTRTrackerServerPeerImpl(HashWrapper _peer_id, int _key_hash_code, byte[] _ip, boolean _ip_override, short _tcp_port, short _udp_port, short _http_port, byte _crypto_level, byte _az_ver, String _ip_str, byte[] _ip_bytes, byte _NAT_status, long _timeout, long _uploaded, long _downloaded, long _amount_left, long _last_contact_time, boolean _download_completed, boolean _biased, short _up_speed) Import constructor -
Method Summary
Modifier and TypeMethodDescriptionexport()longbytegetAZVer()byteprotected booleanlongintgetIP()If asynchronous resolution of the address is required, this will return the non-resolved address until the async process completesbyte[]This will return in resolution of the address is not complete or failsbyte[]getIPRaw()protected intprotected longbytereturns the current NAT status of the peerbyte[]intprotected Stringintprotected longintlongintgetUserData(Object key) voidhostNameResolutionComplete(InetAddress address) static TRTrackerServerPeerImplimportPeer(Map map) booleanisBiased()protected booleanprotected booleanbooleanisSeed()voidNATCheckComplete(boolean ok) protected voidvoidsetBiased(boolean _biased) protected voidprotected voidsetNATStatus(byte status) protected voidsetStats(long _uploaded, long _downloaded, long _amount_left) protected voidsetTimeout(long _now, long _timeout) voidsetUserData(Object key, Object data) protected booleanupdate(byte[] _ip, int _port, int _udp_port, int _http_port, byte _crypto_level, byte _az_ver, int _up_speed, DHTNetworkPosition _network_position)
-
Field Details
-
peer_id
-
key_hash_code
private final int key_hash_code -
ip
private byte[] ip -
ip_override
private final boolean ip_override -
tcp_port
private short tcp_port -
udp_port
private short udp_port -
http_port
private short http_port -
crypto_level
private byte crypto_level -
az_ver
private byte az_ver -
ip_str
-
ip_bytes
private byte[] ip_bytes -
NAT_status
private byte NAT_status -
timeout
private long timeout -
uploaded
private long uploaded -
downloaded
private long downloaded -
amount_left
private long amount_left -
last_contact_time
private long last_contact_time -
download_completed
private boolean download_completed -
biased
private boolean biased -
up_speed
private short up_speed -
network_position
-
user_data
-
-
Constructor Details
-
TRTrackerServerPeerImpl
protected TRTrackerServerPeerImpl(HashWrapper _peer_id, int _key_hash_code, byte[] _ip, boolean _ip_override, int _tcp_port, int _udp_port, int _http_port, byte _crypto_level, byte _az_ver, long _last_contact_time, boolean _download_completed, byte _last_nat_status, int _up_speed, DHTNetworkPosition _network_position) -
TRTrackerServerPeerImpl
protected TRTrackerServerPeerImpl(HashWrapper _peer_id, int _key_hash_code, byte[] _ip, boolean _ip_override, short _tcp_port, short _udp_port, short _http_port, byte _crypto_level, byte _az_ver, String _ip_str, byte[] _ip_bytes, byte _NAT_status, long _timeout, long _uploaded, long _downloaded, long _amount_left, long _last_contact_time, boolean _download_completed, boolean _biased, short _up_speed) Import constructor
-
-
Method Details
-
update
protected boolean update(byte[] _ip, int _port, int _udp_port, int _http_port, byte _crypto_level, byte _az_ver, int _up_speed, DHTNetworkPosition _network_position) -
NATCheckComplete
public void NATCheckComplete(boolean ok) - Specified by:
NATCheckCompletein interfaceTRTrackerServerNatCheckerListener
-
setNATStatus
protected void setNATStatus(byte status) -
getNATStatus
public byte getNATStatus()Description copied from interface:TRTrackerServerPeerreturns the current NAT status of the peer- Specified by:
getNATStatusin interfaceTRTrackerServerPeer- Returns:
-
isNATStatusBad
protected boolean isNATStatusBad() -
resolveAndCheckNAT
protected void resolveAndCheckNAT() -
hostNameResolutionComplete
- Specified by:
hostNameResolutionCompletein interfaceHostNameToIPResolverListener- Parameters:
address- null if resolution failed
-
getLastContactTime
protected long getLastContactTime() -
getDownloadCompleted
protected boolean getDownloadCompleted() -
setDownloadCompleted
protected void setDownloadCompleted() -
isBiased
public boolean isBiased()- Specified by:
isBiasedin interfaceTRTrackerServerPeer- Specified by:
isBiasedin interfaceTRTrackerServerSimplePeer
-
setBiased
public void setBiased(boolean _biased) - Specified by:
setBiasedin interfaceTRTrackerServerPeer
-
getPeerId
- Specified by:
getPeerIdin interfaceTRTrackerServerSimplePeer
-
getPeerID
public byte[] getPeerID()- Specified by:
getPeerIDin interfaceTRTrackerServerPeer
-
getKeyHashCode
protected int getKeyHashCode() -
getIPAsRead
public byte[] getIPAsRead()- Specified by:
getIPAsReadin interfaceTRTrackerServerSimplePeer
-
getIPRaw
- Specified by:
getIPRawin interfaceTRTrackerServerPeer
-
getIP
If asynchronous resolution of the address is required, this will return the non-resolved address until the async process completes- Specified by:
getIPin interfaceTRTrackerServerPeerBase
-
isIPOverride
protected boolean isIPOverride() -
getIPAddressBytes
public byte[] getIPAddressBytes()This will return in resolution of the address is not complete or fails- Specified by:
getIPAddressBytesin interfaceTRTrackerServerSimplePeer- Returns:
-
getTCPPort
public int getTCPPort()- Specified by:
getTCPPortin interfaceTRTrackerServerPeerBase- Specified by:
getTCPPortin interfaceTRTrackerServerSimplePeer
-
getUDPPort
public int getUDPPort()- Specified by:
getUDPPortin interfaceTRTrackerServerSimplePeer
-
getHTTPPort
public int getHTTPPort()- Specified by:
getHTTPPortin interfaceTRTrackerServerPeerBase- Specified by:
getHTTPPortin interfaceTRTrackerServerSimplePeer
-
getCryptoLevel
public byte getCryptoLevel()- Specified by:
getCryptoLevelin interfaceTRTrackerServerSimplePeer
-
getAZVer
public byte getAZVer()- Specified by:
getAZVerin interfaceTRTrackerServerSimplePeer
-
getUpSpeed
public int getUpSpeed()- Specified by:
getUpSpeedin interfaceTRTrackerServerSimplePeer
-
getNetworkPosition
- Specified by:
getNetworkPositionin interfaceTRTrackerServerSimplePeer
-
setTimeout
protected void setTimeout(long _now, long _timeout) -
getTimeout
protected long getTimeout() -
getSecsToLive
public int getSecsToLive()- Specified by:
getSecsToLivein interfaceTRTrackerServerPeerBase
-
setStats
protected void setStats(long _uploaded, long _downloaded, long _amount_left) -
getUploaded
public long getUploaded()- Specified by:
getUploadedin interfaceTRTrackerServerPeer
-
getDownloaded
public long getDownloaded()- Specified by:
getDownloadedin interfaceTRTrackerServerPeer
-
getAmountLeft
public long getAmountLeft()- Specified by:
getAmountLeftin interfaceTRTrackerServerPeer
-
isSeed
public boolean isSeed()- Specified by:
isSeedin interfaceTRTrackerServerSimplePeer
-
setUserData
- Specified by:
setUserDatain interfaceTRTrackerServerPeer
-
getUserData
- Specified by:
getUserDatain interfaceTRTrackerServerPeer
-
export
- Specified by:
exportin interfaceTRTrackerServerPeer
-
importPeer
-
getString
-