Talk:Chord project

From Wikipedia, the free encyclopedia

An example of a diagram (though copyrighted) can be found in this PDF file.

[edit] Pseudocode for find_successor

I believe there is a mistake in the pseudocode, from my understanding there is a missing line above 'return successor.find_successor(id);'. The version of pseudocode used for find_successor is only useful when stepping node by node round the circle, but the proper version using the finger table (as it is suggested this is, with the closest_preceding_node code) requires a call to that function.

Original: // ask node n to find the successor of id

n.find_successor(id)
  if (id\in(n, successor))
    return successor;
  else
    // forward the query around the circle
    return successor.find_successor(id);

// search the local table for the highest predecessor of id
n.closest_preceding_node(id)
  for i = m downto 1
    if(finger[i]\in(n,id))
      return finger[i];
  return n;


Proposed: // ask node n to find the successor of id

n.find_successor(id)
  if (id\in(n, successor))
    return successor;
  else
    // forward the query around the circle
    
    n' = closest_preceding_node(id)
    return n'.find_successor(id); // ADDED LINE

// search the local table for the highest predecessor of id
n.closest_preceding_node(id)
  for i = m downto 1
    if(finger[i]\in(n,id))
      return finger[i];
  return n;


I apologise if it would have been more appropriate to simply edit the post but in the case of such a hidden error if my code were incorrect it could cause many more problems.