Package com.biglybt.core.dht.router
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 TypeMethodDescriptionboolean
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"contactDead
(byte[] node_id, boolean force) Informs the router that an attempt to interact with the contact failedvoid
contactKnown
(byte[] node_id, DHTRouterContactAttachment attachment, boolean force) Adds a contact to the router.boolean
Returns whether the given observer is already observing.void
destroy()
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 DHTRouter
byte[]
getID()
int
getK()
getStats()
boolean
isID
(byte[] node_id) void
print()
void
recordLookup
(byte[] node_id) void
refreshIdleLeaves
(long idle_max) byte[]
boolean
Removes the observer if it is already observing.boolean
requestPing
(byte[] node_id) void
seed()
Tells the router to perform its "start of day" functions required to integrate it into the DHT (search for itself, refresh buckets)void
setAdapter
(DHTRouterAdapter _adapter) void
setSleeping
(boolean sleeping) void
setSuspended
(boolean susp)
-
Field Details
-
delegate
-
-
Constructor Details
-
DHTRouterWrapper
-
-
Method Details
-
getDelegate
-
getK
public int getK() -
getID
public byte[] getID() -
isID
public boolean isID(byte[] node_id) -
getLocalContact
- Specified by:
getLocalContact
in interfaceDHTRouter
-
setAdapter
- Specified by:
setAdapter
in interfaceDHTRouter
-
seed
public void seed()Description copied from interface:DHTRouter
Tells the router to perform its "start of day" functions required to integrate it into the DHT (search for itself, refresh buckets) -
contactKnown
Description copied from interface:DHTRouter
Adds 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:
contactKnown
in interfaceDHTRouter
- Parameters:
node_id
-attachment
-
-
contactAlive
Description copied from interface:DHTRouter
Adds a contact to the router and marks it as "known to be alive"- Specified by:
contactAlive
in interfaceDHTRouter
- Parameters:
node_id
-attachment
-
-
contactDead
Description copied from interface:DHTRouter
Informs the router that an attempt to interact with the contact failed- Specified by:
contactDead
in interfaceDHTRouter
- Parameters:
node_id
-- Returns:
-
findContact
- Specified by:
findContact
in interfaceDHTRouter
-
findClosestContacts
public List<DHTRouterContact> findClosestContacts(byte[] node_id, int num_to_return, boolean live_only) Description copied from interface:DHTRouter
Returns num_to_return or a few more closest contacts, unordered- Specified by:
findClosestContacts
in interfaceDHTRouter
-
recordLookup
public void recordLookup(byte[] node_id) - Specified by:
recordLookup
in interfaceDHTRouter
-
requestPing
public boolean requestPing(byte[] node_id) - Specified by:
requestPing
in interfaceDHTRouter
-
refreshIdleLeaves
public void refreshIdleLeaves(long idle_max) - Specified by:
refreshIdleLeaves
in interfaceDHTRouter
-
refreshRandom
public byte[] refreshRandom()- Specified by:
refreshRandom
in interfaceDHTRouter
-
findBestContacts
Description copied from interface:DHTRouter
returns a list of best contacts in terms of uptime, best first- Specified by:
findBestContacts
in interfaceDHTRouter
- Parameters:
max
-- Returns:
-
getAllContacts
Description copied from interface:DHTRouter
Returns a list of DHTRouterContact objects- Specified by:
getAllContacts
in interfaceDHTRouter
- Returns:
-
getStats
-
setSleeping
public void setSleeping(boolean sleeping) - Specified by:
setSleeping
in interfaceDHTRouter
-
setSuspended
public void setSuspended(boolean susp) - Specified by:
setSuspended
in interfaceDHTRouter
-
destroy
public void destroy() -
print
public void print() -
addObserver
Description copied from interface:DHTRouter
Adds a routing table observer if it is not already observing.- Specified by:
addObserver
in interfaceDHTRouter
- Parameters:
rto
- the observer to add- Returns:
true
if now observing,false
otherwise
-
containsObserver
Description copied from interface:DHTRouter
Returns whether the given observer is already observing.- Specified by:
containsObserver
in interfaceDHTRouter
- Parameters:
rto
- the observer to query as observing- Returns:
true
if observing,false
otherwise
-
removeObserver
Description copied from interface:DHTRouter
Removes the observer if it is already observing.- Specified by:
removeObserver
in interfaceDHTRouter
- Parameters:
rto
- the observer to remove- Returns:
true
if no longer observing,false
otherwise
-