|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.aelitis.azureus.core.dht.router.impl.DHTRouterImpl
public class DHTRouterImpl
Constructor Summary | |
---|---|
DHTRouterImpl(int _K,
int _B,
int _max_rep_per_node,
byte[] _router_node_id,
DHTRouterContactAttachment _attachment,
DHTLogger _logger)
|
Method Summary | |
---|---|
void |
addContact(byte[] node_id,
DHTRouterContactAttachment attachment,
boolean known_to_be_alive)
|
boolean |
addObserver(DHTRouterObserver rto)
Adds a routing table observer if it is not already observing. |
void |
contactAlive(byte[] node_id,
DHTRouterContactAttachment attachment)
Adds a contact to the router and marks it as "known to be alive" |
DHTRouterContact |
contactDead(byte[] node_id,
boolean force)
Informs the router that an attempt to interact with the contact failed |
void |
contactKnown(byte[] node_id,
DHTRouterContactAttachment attachment,
boolean force)
Adds a contact to the router. |
void |
contactRemoved(byte[] node_id)
|
boolean |
containsObserver(DHTRouterObserver rto)
Returns whether the given observer is already observing. |
void |
destroy()
|
protected void |
dispatchNodeAdds()
|
protected void |
dispatchPings()
|
protected void |
findAllContacts(List list,
DHTRouterNodeImpl node)
|
protected void |
findAllContacts(Set set,
DHTRouterNodeImpl node)
|
List |
findBestContacts(int max)
returns a list of best contacts in terms of uptime, best first |
List |
findClosestContacts(byte[] node_id,
int num_to_return,
boolean live_only)
Returns num_to_return or a few more closest contacts, unordered |
protected void |
findClosestContacts(byte[] node_id,
int num_to_return,
int depth,
DHTRouterNodeImpl current_node,
boolean live_only,
List res)
|
DHTRouterContact |
findContact(byte[] node_id)
|
protected Object[] |
findContactSupport(byte[] node_id)
|
protected DHTRouterNodeImpl |
findNode(byte[] node_id)
|
List |
getAllContacts()
Returns a list of DHTRouterContact objects |
protected long |
getContactCount()
|
protected long |
getContactCount(DHTRouterNodeImpl node)
|
byte[] |
getID()
|
int |
getK()
|
DHTRouterContact |
getLocalContact()
|
protected long |
getNodeCount()
|
protected long |
getNodeCount(DHTRouterNodeImpl node)
|
protected DHTRouterNodeImpl |
getSmallestSubtree()
|
DHTRouterStats |
getStats()
|
protected long[] |
getStatsSupport()
|
protected void |
getStatsSupport(long[] stats_array,
DHTRouterNodeImpl node)
|
boolean |
isID(byte[] id)
|
protected void |
log(String str)
|
protected void |
notifyAdded(DHTRouterContact contact)
|
protected void |
notifyDead()
|
protected void |
notifyLocationChanged(DHTRouterContact contact)
|
protected void |
notifyNowAlive(DHTRouterContact contact)
|
protected void |
notifyNowFailing(DHTRouterContact contact)
|
protected void |
notifyRemoved(DHTRouterContact contact)
|
protected void |
pingeroonies()
|
void |
print()
|
void |
recordLookup(byte[] node_id)
|
void |
refreshIdleLeaves(long idle_max)
|
protected void |
refreshNode(List nodes_to_refresh,
DHTRouterNodeImpl node,
byte[] path)
|
protected void |
refreshNodes(List nodes_to_refresh,
DHTRouterNodeImpl node,
byte[] path,
boolean seeding,
long max_permitted_idle)
|
byte[] |
refreshRandom()
|
boolean |
removeObserver(DHTRouterObserver rto)
Removes the observer if it is already observing. |
protected void |
requestLookup(byte[] id,
String description)
|
protected void |
requestNodeAdd(DHTRouterContactImpl contact)
|
boolean |
requestPing(byte[] node_id)
|
protected void |
requestPing(DHTRouterContactImpl contact)
|
void |
seed()
Tells the router to perform its "start of day" functions required to integrate it into the DHT (search for itself, refresh buckets) |
protected void |
seedSupport()
|
void |
setAdapter(DHTRouterAdapter _adapter)
|
void |
setSleeping(boolean _sleeping)
|
void |
setSuspended(boolean _suspended)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DHTRouterImpl(int _K, int _B, int _max_rep_per_node, byte[] _router_node_id, DHTRouterContactAttachment _attachment, DHTLogger _logger)
Method Detail |
---|
protected void notifyAdded(DHTRouterContact contact)
protected void notifyRemoved(DHTRouterContact contact)
protected void notifyLocationChanged(DHTRouterContact contact)
protected void notifyNowAlive(DHTRouterContact contact)
protected void notifyNowFailing(DHTRouterContact contact)
protected void notifyDead()
public boolean addObserver(DHTRouterObserver rto)
DHTRouter
addObserver
in interface DHTRouter
rto
- the observer to add
true
if now observing, false
otherwisepublic boolean containsObserver(DHTRouterObserver rto)
DHTRouter
containsObserver
in interface DHTRouter
rto
- the observer to query as observing
true
if observing, false
otherwisepublic boolean removeObserver(DHTRouterObserver rto)
DHTRouter
removeObserver
in interface DHTRouter
rto
- the observer to remove
true
if no longer observing, false
otherwisepublic DHTRouterStats getStats()
getStats
in interface DHTRouter
public int getK()
getK
in interface DHTRouter
public byte[] getID()
getID
in interface DHTRouter
public boolean isID(byte[] id)
isID
in interface DHTRouter
public DHTRouterContact getLocalContact()
getLocalContact
in interface DHTRouter
public void setAdapter(DHTRouterAdapter _adapter)
setAdapter
in interface DHTRouter
public void setSleeping(boolean _sleeping)
setSleeping
in interface DHTRouter
public void setSuspended(boolean _suspended)
setSuspended
in interface DHTRouter
public void contactKnown(byte[] node_id, DHTRouterContactAttachment attachment, boolean force)
DHTRouter
contactKnown
in interface DHTRouter
public void contactAlive(byte[] node_id, DHTRouterContactAttachment attachment)
DHTRouter
contactAlive
in interface DHTRouter
public DHTRouterContact contactDead(byte[] node_id, boolean force)
DHTRouter
contactDead
in interface DHTRouter
public void contactRemoved(byte[] node_id)
public void addContact(byte[] node_id, DHTRouterContactAttachment attachment, boolean known_to_be_alive)
public List findClosestContacts(byte[] node_id, int num_to_return, boolean live_only)
DHTRouter
findClosestContacts
in interface DHTRouter
protected void findClosestContacts(byte[] node_id, int num_to_return, int depth, DHTRouterNodeImpl current_node, boolean live_only, List res)
public DHTRouterContact findContact(byte[] node_id)
findContact
in interface DHTRouter
protected DHTRouterNodeImpl findNode(byte[] node_id)
protected Object[] findContactSupport(byte[] node_id)
protected long getNodeCount()
protected long getNodeCount(DHTRouterNodeImpl node)
protected long getContactCount()
protected long getContactCount(DHTRouterNodeImpl node)
public List findBestContacts(int max)
DHTRouter
findBestContacts
in interface DHTRouter
public List getAllContacts()
DHTRouter
getAllContacts
in interface DHTRouter
protected void findAllContacts(Set set, DHTRouterNodeImpl node)
protected void findAllContacts(List list, DHTRouterNodeImpl node)
public void seed()
DHTRouter
seed
in interface DHTRouter
protected void seedSupport()
protected void refreshNodes(List nodes_to_refresh, DHTRouterNodeImpl node, byte[] path, boolean seeding, long max_permitted_idle)
protected void refreshNode(List nodes_to_refresh, DHTRouterNodeImpl node, byte[] path)
protected DHTRouterNodeImpl getSmallestSubtree()
public void recordLookup(byte[] node_id)
recordLookup
in interface DHTRouter
public void refreshIdleLeaves(long idle_max)
refreshIdleLeaves
in interface DHTRouter
public boolean requestPing(byte[] node_id)
requestPing
in interface DHTRouter
protected void requestPing(DHTRouterContactImpl contact)
protected void dispatchPings()
protected void pingeroonies()
protected void requestNodeAdd(DHTRouterContactImpl contact)
protected void dispatchNodeAdds()
public byte[] refreshRandom()
refreshRandom
in interface DHTRouter
protected void requestLookup(byte[] id, String description)
protected void getStatsSupport(long[] stats_array, DHTRouterNodeImpl node)
protected long[] getStatsSupport()
protected void log(String str)
public void print()
print
in interface DHTRouter
public void destroy()
destroy
in interface DHTRouter
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |