libktorrent  2.1.1
Public Member Functions | List of all members
dht::Node Class Reference

#include <node.h>

Inheritance diagram for dht::Node:
Inheritance graph
[legend]

Public Member Functions

 Node (RPCServer *srv, const QString &key_file)
 
void findKClosestNodes (KClosestNodesSearch &kns, bt::Uint32 want)
 
bt::Uint32 getNumEntriesInRoutingTable () const
 Get the number of entries in the routing table.
 
const dht::KeygetOurID () const
 Get our own ID.
 
void loadTable (const QString &file)
 Load the routing table from a file.
 
void onTimeout (RPCMsg::Ptr msg)
 
void received (DHT *dh_table, const RPCMsg &msg)
 
void refreshBuckets (DHT *dh_table)
 Check if a buckets needs to be refreshed, and refresh if necesarry.
 
void saveTable (const QString &file)
 Save the routing table to a file.
 

Detailed Description

Author
Joris Guisson

A Node represents us in the kademlia network. It contains our id and 160 KBucket's. A KBucketEntry is in node i, when the difference between our id and the KBucketEntry's id is between 2 to the power i and 2 to the power i+1.

Definition at line 50 of file node.h.

Member Function Documentation

◆ findKClosestNodes()

void dht::Node::findKClosestNodes ( KClosestNodesSearch kns,
bt::Uint32  want 
)

Find the K closest entries to a key and store them in the KClosestNodesSearch object.

Parameters
knsThe object to storre the search results
wantWhich protocol(s) are wanted

◆ onTimeout()

void dht::Node::onTimeout ( RPCMsg::Ptr  msg)

Increase the failed queries count of the bucket entry we sent the message to

◆ received()

void dht::Node::received ( DHT dh_table,
const RPCMsg msg 
)

An RPC message was received, the node must now update the right bucket.

Parameters
dh_tableThe DHT
msgThe message
srvThe RPCServer to send a ping if necessary

The documentation for this class was generated from the following file: