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