Class DHTRouterWrapper
java.lang.Object
com.biglybt.core.dht.router.DHTRouterWrapper
- All Implemented Interfaces:
DHTRouter
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanAdds a routing table observer if it is not already observing.voidcontactAlive(byte[] node_id, DHTRouterContactAttachment attachment) Adds a contact to the router and marks it as "known to be alive"contactDead(byte[] node_id, boolean force) Informs the router that an attempt to interact with the contact failedvoidcontactKnown(byte[] node_id, DHTRouterContactAttachment attachment, boolean force) Adds a contact to the router.booleanReturns whether the given observer is already observing.voiddestroy()findBestContacts(int max) returns a list of best contacts in terms of uptime, best firstfindClosestContacts(byte[] node_id, int num_to_return, boolean live_only) Returns num_to_return or a few more closest contacts, unorderedfindContact(byte[] node_id) Returns a list of DHTRouterContact objectsprotected DHTRouterbyte[]getID()intgetK()getStats()booleanisID(byte[] node_id) voidprint()voidrecordLookup(byte[] node_id) voidrefreshIdleLeaves(long idle_max) byte[]booleanRemoves the observer if it is already observing.booleanrequestPing(byte[] node_id) voidseed()Tells the router to perform its "start of day" functions required to integrate it into the DHT (search for itself, refresh buckets)voidsetAdapter(DHTRouterAdapter _adapter) voidsetSleeping(boolean sleeping) voidsetSuspended(boolean susp)
-
Field Details
-
delegate
-
-
Constructor Details
-
DHTRouterWrapper
-
-
Method Details
-
getDelegate
-
getK
-
getID
-
isID
-
getLocalContact
- Specified by:
getLocalContactin interfaceDHTRouter
-
setAdapter
- Specified by:
setAdapterin interfaceDHTRouter
-
seed
-
contactKnown
Description copied from interface:DHTRouterAdds a contact to the router. The contact is not known to be alive (e.g. we've been returned the contact by someone but we've not either got a reply from it, nor has it invoked us.- Specified by:
contactKnownin interfaceDHTRouter- Parameters:
node_id-attachment-
-
contactAlive
Description copied from interface:DHTRouterAdds a contact to the router and marks it as "known to be alive"- Specified by:
contactAlivein interfaceDHTRouter- Parameters:
node_id-attachment-
-
contactDead
Description copied from interface:DHTRouterInforms the router that an attempt to interact with the contact failed- Specified by:
contactDeadin interfaceDHTRouter- Parameters:
node_id-- Returns:
-
findContact
- Specified by:
findContactin interfaceDHTRouter
-
findClosestContacts
public List<DHTRouterContact> findClosestContacts(byte[] node_id, int num_to_return, boolean live_only) Description copied from interface:DHTRouterReturns num_to_return or a few more closest contacts, unordered- Specified by:
findClosestContactsin interfaceDHTRouter
-
recordLookup
public void recordLookup(byte[] node_id) - Specified by:
recordLookupin interfaceDHTRouter
-
requestPing
public boolean requestPing(byte[] node_id) - Specified by:
requestPingin interfaceDHTRouter
-
refreshIdleLeaves
public void refreshIdleLeaves(long idle_max) - Specified by:
refreshIdleLeavesin interfaceDHTRouter
-
refreshRandom
public byte[] refreshRandom()- Specified by:
refreshRandomin interfaceDHTRouter
-
findBestContacts
Description copied from interface:DHTRouterreturns a list of best contacts in terms of uptime, best first- Specified by:
findBestContactsin interfaceDHTRouter- Parameters:
max-- Returns:
-
getAllContacts
Description copied from interface:DHTRouterReturns a list of DHTRouterContact objects- Specified by:
getAllContactsin interfaceDHTRouter- Returns:
-
getStats
-
setSleeping
public void setSleeping(boolean sleeping) - Specified by:
setSleepingin interfaceDHTRouter
-
setSuspended
public void setSuspended(boolean susp) - Specified by:
setSuspendedin interfaceDHTRouter
-
destroy
-
print
-
addObserver
Description copied from interface:DHTRouterAdds a routing table observer if it is not already observing.- Specified by:
addObserverin interfaceDHTRouter- Parameters:
rto- the observer to add- Returns:
trueif now observing,falseotherwise
-
containsObserver
Description copied from interface:DHTRouterReturns whether the given observer is already observing.- Specified by:
containsObserverin interfaceDHTRouter- Parameters:
rto- the observer to query as observing- Returns:
trueif observing,falseotherwise
-
removeObserver
Description copied from interface:DHTRouterRemoves the observer if it is already observing.- Specified by:
removeObserverin interfaceDHTRouter- Parameters:
rto- the observer to remove- Returns:
trueif no longer observing,falseotherwise
-