2

As I understand the first lookup request is sent to the node which is the closest one in the routing table to the info hash of the torrent

During the process of peer lookup I can receive many nodes. When I perform next peer lookup can I start peer lookup from one of them or I must start from the peers in my routing table?

liamzebedee
  • 14,010
  • 21
  • 72
  • 118
Art Spasky
  • 1,635
  • 2
  • 17
  • 30

1 Answers1

1

The details of the Kademlia routing and replacement algorithm can be found in the original paper. Basically, you only replace nodes in your routing table when they start failing; however you subdivide the bucket around your ID until the smallest bucket has less than K nodes (where K is as specified in the bittorrent DHT protocol documentation). When starting searches, you use the K routing table nodes in your routing table bucket containing the routing ID of the key being searched.

bdonlan
  • 224,562
  • 31
  • 268
  • 324
  • Thank you for the response. Can I ask you when the mainline DHT client stop searching for the info hash or for the node id? – Art Spasky Aug 15 '11 at 16:35
  • @Art, the procedure is described in the Kademlia paper; look for the 'node lookup' algorithm, starting at the bottom of the left column on page 3. – bdonlan Aug 16 '11 at 01:39
  • I have read this paper. But this paper about Kademlia DHT. I am interested in mainline DHT implementation. About FIND_VALUE (Mainline get_peers) it writes "Moreover, the procedure halts immediately when any node returns the value", but node does not return all peers, only subset. – Art Spasky Aug 16 '11 at 07:13
  • @Art, presumably, it's an optimization where if you find the actual value you're looking for (rather than just a list of peers), then you can stop there rather than continuing to query for peers. – bdonlan Aug 16 '11 at 19:01