Package com.biglybt.core.dht.router.impl
Class DHTRouterContactImpl
java.lang.Object
com.biglybt.core.dht.router.impl.DHTRouterContactImpl
- All Implemented Interfaces:
DHTRouterContact
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate DHTRouterContactAttachment
private int
private long
private long
private boolean
private boolean
private long
private final byte[]
private boolean
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
DHTRouterContactImpl
(byte[] _node_id, DHTRouterContactAttachment _attachment, boolean _has_been_alive) -
Method Summary
Modifier and TypeMethodDescriptionprotected int
protected long
protected long
protected long
byte[]
getID()
protected long
protected long
protected boolean
protected void
long
time between first establishing the contact was alive and now, assuming that its not failing.boolean
indicates whether or not a message has been received from, or an operation has successfully been made to, the contact.protected boolean
boolean
isAlive()
Whether or not the contact's last interaction was successfulboolean
Returns whether this router contact is in a bucket.boolean
Whether or not the contact has failed once or more since last alive (if ever)boolean
Returns whether this router contact is a replacement.void
setAlive()
protected void
setAttachment
(DHTRouterContactAttachment _attachment) void
protected boolean
protected void
setLastAddedTime
(long l) protected void
setPingOutstanding
(boolean b) void
-
Field Details
-
node_id
private final byte[] node_id -
attachment
-
has_been_alive
private boolean has_been_alive -
ping_outstanding
private boolean ping_outstanding -
fail_count
private int fail_count -
first_alive_time
private long first_alive_time -
first_fail_or_last_alive_time
private long first_fail_or_last_alive_time -
last_added_time
private long last_added_time -
is_bucket_entry
private boolean is_bucket_entry
-
-
Constructor Details
-
DHTRouterContactImpl
protected DHTRouterContactImpl(byte[] _node_id, DHTRouterContactAttachment _attachment, boolean _has_been_alive)
-
-
Method Details
-
getID
public byte[] getID()- Specified by:
getID
in interfaceDHTRouterContact
-
getAttachment
- Specified by:
getAttachment
in interfaceDHTRouterContact
-
setAttachment
-
setAlive
public void setAlive() -
hasBeenAlive
public boolean hasBeenAlive()Description copied from interface:DHTRouterContact
indicates whether or not a message has been received from, or an operation has successfully been made to, the contact.- Specified by:
hasBeenAlive
in interfaceDHTRouterContact
- Returns:
-
isAlive
public boolean isAlive()Description copied from interface:DHTRouterContact
Whether or not the contact's last interaction was successful- Specified by:
isAlive
in interfaceDHTRouterContact
- Returns:
-
isFailing
public boolean isFailing()Description copied from interface:DHTRouterContact
Whether or not the contact has failed once or more since last alive (if ever)- Specified by:
isFailing
in interfaceDHTRouterContact
- Returns:
-
getFailCount
protected int getFailCount() -
getTimeAlive
public long getTimeAlive()Description copied from interface:DHTRouterContact
time between first establishing the contact was alive and now, assuming that its not failing. 0 -> failing- Specified by:
getTimeAlive
in interfaceDHTRouterContact
- Returns:
-
setFailed
protected boolean setFailed() -
hasFailed
protected boolean hasFailed() -
getFirstFailTime
protected long getFirstFailTime() -
getLastAliveTime
protected long getLastAliveTime() -
getFirstFailOrLastAliveTime
protected long getFirstFailOrLastAliveTime() -
getFirstAliveTime
protected long getFirstAliveTime() -
getLastAddedTime
protected long getLastAddedTime() -
setLastAddedTime
protected void setLastAddedTime(long l) -
setPingOutstanding
protected void setPingOutstanding(boolean b) -
getPingOutstanding
protected boolean getPingOutstanding() -
getString
- Specified by:
getString
in interfaceDHTRouterContact
-
getString
-
isBucketEntry
public boolean isBucketEntry()Description copied from interface:DHTRouterContact
Returns whether this router contact is in a bucket.- Specified by:
isBucketEntry
in interfaceDHTRouterContact
- Returns:
true
if in a bucket,false
otherwise
-
setBucketEntry
public void setBucketEntry() -
isReplacement
public boolean isReplacement()Description copied from interface:DHTRouterContact
Returns whether this router contact is a replacement.- Specified by:
isReplacement
in interfaceDHTRouterContact
- Returns:
true
if a replacement,false
otherwise
-
setReplacement
public void setReplacement()
-