Methods Summary |
---|
protected boolean | addressMatchesID()
return( id != null );
|
public void | exportContact(java.io.DataOutputStream os)
transport.exportContact( this, os );
|
public java.net.InetSocketAddress | getAddress()
return( getExternalAddress());
|
public long | getClockSkew()
return( skew );
|
public java.net.InetSocketAddress | getExternalAddress()
return( external_address );
|
public byte[] | getID()
if ( id == null ){
throw( new RuntimeException( "Invalid contact" ));
}
return( id );
|
public int | getInstanceID()
return( instance_id );
|
public int | getMaxFailForLiveCount()
return( transport.getMaxFailForLiveCount() );
|
public int | getMaxFailForUnknownCount()
return( transport.getMaxFailForUnknownCount() );
|
public java.lang.String | getName()
return( DHTLog.getString2( id ));
|
public com.aelitis.azureus.core.dht.netcoords.DHTNetworkPosition | getNetworkPosition(byte position_type)
for (int i=0;i<network_positions.length;i++){
if ( network_positions[i].getPositionType() == position_type ){
return( network_positions[i] );
}
}
return( null );
|
public com.aelitis.azureus.core.dht.netcoords.DHTNetworkPosition[] | getNetworkPositions()
return( network_positions );
|
protected int | getNodeStatus()
return( node_status );
|
public byte | getProtocolVersion()
return( protocol_version );
|
public int | getRandomID()
return( random_id );
|
public DHTTransportFullStats | getStats()
return( transport.getFullStats( this ));
|
public java.lang.String | getString()
if ( transport_address.equals( external_address )){
return( DHTLog.getString2(id) + "["+transport_address.toString()+",V" + getProtocolVersion() +"]");
}
return( DHTLog.getString2(id) + "[tran="+transport_address.toString()+",ext="+external_address+",V" + getProtocolVersion() +"]");
|
public DHTTransport | getTransport()
return( transport );
|
public java.net.InetSocketAddress | getTransportAddress()
return( transport_address );
|
public boolean | isAlive(long timeout)
final AESemaphore sem = new AESemaphore( "DHTTransportContact:alive");
final boolean[] alive = { false };
try{
sendPing(
new DHTTransportReplyHandlerAdapter()
{
public void
pingReply(
DHTTransportContact contact )
{
alive[0] = true;
sem.release();
}
public void
failed(
DHTTransportContact contact,
Throwable cause )
{
sem.release();
}
});
sem.reserve( timeout );
return( alive[0] );
}catch( Throwable e ){
return( false );
}
|
public boolean | isValid()
return( addressMatchesID() &&
!transport.invalidExternalAddress( external_address.getAddress()));
|
public void | remove()
transport.removeContact( this );
|
public void | sendFindNode(DHTTransportReplyHandler handler, byte[] nid)
transport.sendFindNode( this, handler, nid );
|
public void | sendFindValue(DHTTransportReplyHandler handler, byte[] key, int max_values, byte flags)
transport.sendFindValue( this, handler, key, max_values, flags );
|
public void | sendImmediatePing(DHTTransportReplyHandler handler, long timeout)
transport.sendImmediatePing( this, handler, timeout );
|
public void | sendKeyBlock(DHTTransportReplyHandler handler, byte[] request, byte[] signature)
// gotta do anti-spoof
sendFindNode(
new DHTTransportReplyHandlerAdapter()
{
public void
findNodeReply(
DHTTransportContact contact,
DHTTransportContact[] contacts )
{
transport.sendKeyBlockRequest( DHTTransportUDPContactImpl.this, handler, request, signature );
}
public void
failed(
DHTTransportContact _contact,
Throwable _error )
{
handler.failed( _contact, _error );
}
},
new byte[0] );
|
public void | sendPing(DHTTransportReplyHandler handler)
transport.sendPing( this, handler );
|
public void | sendStats(DHTTransportReplyHandler handler)
transport.sendStats( this, handler );
|
public void | sendStore(DHTTransportReplyHandler handler, byte[][] keys, DHTTransportValue[][] value_sets)
transport.sendStore( this, handler, keys, value_sets );
|
protected void | setInstanceIDAndVersion(int _instance_id, byte _protocol_version)
instance_id = _instance_id;
// target supports a higher version than we thought, update
if ( _protocol_version > protocol_version ){
protocol_version = _protocol_version;
}
|
protected void | setNetworkPositions(com.aelitis.azureus.core.dht.netcoords.DHTNetworkPosition[] positions)
network_positions = positions;
|
protected void | setNodeStatus(int ns)
node_status = ns;
|
protected void | setProtocolVersion(byte v)
protocol_version = v;
|
public void | setRandomID(int _random_id)
random_id = _random_id;
|
public void | setTransportAddress(java.net.InetSocketAddress address)
transport_address = address;
|