开发者

Mainline DHT bootstrap process

Can somebody clarify me the statement from the specification of mainline DHT?

Upon inserting the first node into its routing table and when starting up thereafter, the node should attempt to find the closest nodes in the DHT to itself. It does this by issuing find_node messages to closer and closer nodes until it cannot find any closer.

What does "until it cannot find any closer" mean?

When my program start to send find_node messages it has empty set of nodes. Each response to find_node message returns about 8 dht nodes. My program collects the开发者_运维问答m in the list.

When must my program stop sending find node messages?

I think that it must stop sending when it will receive the set of dht nodes all elements of which are in the list of already collected nodes?

Am I right?

Thank you in advance.


Mainline DHT is a kademlia implementation, for details, see the paper.

From the 8 nodes you receive, sort them by their node-id's closeness to your own ID, then send find_node to the 3 top ones (the 3 closest to you). You will then receive 8 x 3 more nodes, insert them in your node list, still ordered by how close the nodes are to you. Keep sending find_node messages to the 3 top nodes (ignoring ones you've already sent messages to), until the nodes you get back are already in your list. i.e. the termination condition is that you have sent a message to all 8 nodes closest to you (at the top of the list).

As the paper explains, the distance metric is XOR. To calculate how far away your node-ID is from another node's, you XOR the node-IDs. The lower the result is, the closer the nodes are to each other.

In real life you might want to do this a bit more sophisticated, by keeping 3 outstanding requests at any given time and temporarily open up more outstanding requests half way through timeouts.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜