libktorrent
2.2.0
|
#include <kbucket.h>
Classes | |
class | UnableToSplit |
Public Types | |
typedef QSharedPointer< KBucket > | Ptr |
Public Member Functions | |
KBucket (const dht::Key &min_key, const dht::Key &max_key, RPCServerInterface *srv, const Key &our_id) | |
KBucket (RPCServerInterface *srv, const Key &our_id) | |
bool | contains (const KBucketEntry &entry) const |
See if this bucket contains an entry. | |
void | findKClosestNodes (KClosestNodesSearch &kns) |
bt::Uint32 | getNumEntries () const |
Get the number of entries. | |
bool | insert (const KBucketEntry &entry) |
bool | keyInRange (const dht::Key &k) const |
Does the key k lies in in the range of this bucket. | |
const KBucketEntry & | leastRecentlySeen () const |
Get the least recently seen node. | |
void | load (bt::BDictNode *dict) |
Load the bucket from a file. | |
const dht::Key & | maxKey () const |
Get the max key. | |
const dht::Key & | minKey () const |
Get the min key. | |
bool | needsToBeRefreshed () const |
Check if the bucket needs to be refreshed. | |
bool | onTimeout (const net::Address &addr) |
void | save (bt::BEncoder &enc) |
save the bucket to a file | |
void | setRefreshTask (Task *t) |
Set the refresh task. | |
std::pair< KBucket::Ptr, KBucket::Ptr > | split () throw (UnableToSplit) |
bool | splitAllowed () const |
Are we allowed to split. | |
void | updateRefreshTimer () |
Update the refresh timer of the bucket. | |
![]() | |
RPCCallListener (QObject *parent) | |
Additional Inherited Members | |
![]() |
A KBucket is just a list of KBucketEntry objects. The list is sorted by time last seen : The first element is the least recently seen, the last the most recently seen.
void dht::KBucket::findKClosestNodes | ( | KClosestNodesSearch & | kns | ) |
Find the K closest entries to a key and store them in the KClosestNodesSearch object.
kns | The object to storre the search results |
bool dht::KBucket::insert | ( | const KBucketEntry & | entry | ) |
Inserts an entry into the bucket.
entry | The entry to insert |
bool dht::KBucket::onTimeout | ( | const net::Address & | addr | ) |
A peer failed to respond
addr | Address of the peer |
std::pair<KBucket::Ptr, KBucket::Ptr> dht::KBucket::split | ( | ) | ||
throw | ( | UnableToSplit | ||
) |
Split the bucket in two new buckets, each containing half the range of the original one.
UnableToSplit | if something goes wrong |