Methods Summary |
---|
public void | NATCheckComplete(boolean ok)
if ( ok ){
NAT_status = NAT_CHECK_OK;
}else{
NAT_status = NAT_CHECK_FAILED;
}
|
protected byte | getAZVer()
return( az_ver );
|
public long | getAmountLeft()
return( amount_left );
|
protected byte | getCryptoLevel()
return( crypto_level );
|
protected boolean | getDownloadCompleted()
return( download_completed );
|
public long | getDownloaded()
return( downloaded );
|
protected int | getHTTPPort()
return( http_port&0xffff );
|
public java.lang.String | getIP()If asynchronous resolution of the address is required, this will return
the non-resolved address until the async process completes
return( ip_str );
|
protected byte[] | getIPAddressBytes()This will return in resolution of the address is not complete or fails
return( ip_bytes );
|
protected byte[] | getIPAsRead()
return( ip );
|
public java.lang.String | getIPRaw()
return( new String(ip));
|
protected int | getKeyHashCode()
return( key_hash_code );
|
protected long | getLastContactTime()
return( last_contact_time );
|
public byte | getNATStatus()
return( NAT_status );
|
protected com.aelitis.azureus.core.dht.netcoords.DHTNetworkPosition | getNetworkPosition()
return( network_position );
|
public byte[] | getPeerID()
return( peer_id.getBytes());
|
protected HashWrapper | getPeerId()
return( peer_id );
|
public int | getSecsToLive()
return((int)(( timeout - SystemTime.getCurrentTime())/1000 ));
|
protected java.lang.String | getString()
return( new String(ip) + ":" + getTCPPort() + "(" + new String(peer_id.getHash()) + ")" );
|
public int | getTCPPort()
return( tcp_port&0xffff );
|
protected long | getTimeout()
return( timeout );
|
protected int | getUDPPort()
return( udp_port&0xffff );
|
protected int | getUpSpeed()
return( up_speed&0xffff );
|
public long | getUploaded()
return( uploaded );
|
public java.lang.Object | getUserData(java.lang.Object key)
if ( user_data == null ){
return( null );
}else if( user_data instanceof Object[]){
Object[] x = (Object[])user_data;
if ( x[0] == key ){
return( x[1] );
}else{
return( null );
}
}else{
return(((Map)user_data).get(key));
}
|
public void | hostNameResolutionComplete(java.net.InetAddress address)
if ( address != null ){
ip_str = address.getHostAddress();
ip_bytes = address.getAddress();
}
|
public boolean | isBiased()
return( biased );
|
protected boolean | isIPOverride()
return( ip_override );
|
protected boolean | isNATStatusBad()
return( NAT_status == NAT_CHECK_FAILED || NAT_status == NAT_CHECK_FAILED_AND_REPORTED );
|
protected boolean | isSeed()
return( amount_left == 0 );
|
protected void | resolveAndCheckNAT()
// default values pending resolution
ip_str = new String( ip );
ip_bytes = null;
HostNameToIPResolver.addResolverRequest( ip_str, this );
// a port of 0 is taken to mean that the client can't/won't receive incoming
// connections - tr
if ( tcp_port == 0 ){
NAT_status = NAT_CHECK_FAILED_AND_REPORTED;
}else{
// only recheck if we haven't already ascertained the state
if ( NAT_status == NAT_CHECK_UNKNOWN ){
NAT_status = NAT_CHECK_INITIATED;
if ( !TRTrackerServerNATChecker.getSingleton().addNATCheckRequest( ip_str, getTCPPort(), this )){
NAT_status = NAT_CHECK_DISABLED;
}
}
}
|
public void | setBiased(boolean _biased)
biased = _biased;
|
protected void | setDownloadCompleted()
download_completed = true;
|
protected void | setNATStatus(byte status)
NAT_status = status;
|
protected void | setStats(long _uploaded, long _downloaded, long _amount_left)
uploaded = _uploaded;
downloaded = _downloaded;
amount_left = _amount_left;
|
protected void | setTimeout(long _now, long _timeout)
last_contact_time = _now;
timeout = _timeout;
|
public void | setUserData(java.lang.Object key, java.lang.Object data)
if ( user_data == null ){
user_data = new Object[]{ key, data };
}else if ( user_data instanceof Object[]){
Object[] x = (Object[])user_data;
if ( x[0] == key ){
x[1] = data;
}else{
HashMap map = new HashMap();
user_data = map;
map.put( x[0], x[1] );
map.put( key, data );
}
}else{
((Map)user_data).put( key, data );
}
|
protected boolean | update(byte[] _ip, int _port, int _udp_port, int _http_port, byte _crypto_level, byte _az_ver, int _up_speed, com.aelitis.azureus.core.dht.netcoords.DHTNetworkPosition _network_position)
udp_port = (short)_udp_port;
http_port = (short)_http_port;
crypto_level = _crypto_level;
az_ver = _az_ver;
up_speed = _up_speed>Short.MAX_VALUE?Short.MAX_VALUE:(short)_up_speed;
network_position = _network_position;
boolean res = false;
if ( _port != getTCPPort() ){
tcp_port = (short)_port;
res = true;
}
if ( !Arrays.equals( _ip, ip )){
ip = _ip;
res = true;
}
if ( res ){
resolveAndCheckNAT();
}
return( res );
|