Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8966129
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T16:57:36+00:00 2026-06-15T16:57:36+00:00

I am currently dealing with the Chord protocol. For each node there are two

  • 0

I am currently dealing with the Chord protocol.

For each node there are two functions, findSuccessor and closestPrecedingNode which are given as pseudo-code.

findSuccessor is:

n.findSuccessor(id)
  if(id is.in (n, successor])
    return successor;
  else
    n' = closestPrecedingNode(id);
    return n'.findSuccessor(id);

closestPrecedingNode is:

n.closestPrecedingNode(id)
  for i = m downto 1
    if(finger[i] is.in (n, id))
      return finger[i];
  return n;

When a node is created, its successor is initially set to the node itself, and its finger table is empty.

Now my question is what happens when there is only one single node, and it is asked for any id except its own id. Then findSuccessor runs the else block and calls closestPrecedingNode. Since the finger table is empty, the node itself is returned to findSuccessor. Hence n' is then equal to n.

Afterwards, findSuccessor is called on n', which is a recursive call to itself.

And then we have an infinite loop … or am I missing something?

NOTE: Pseudo-code is taken from Chord: A Scalable Peer-to-peer Lookup Protocol
for Internet Applications
, page 5.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T16:57:38+00:00Added an answer on June 15, 2026 at 4:57 pm

    The implementer of “jchord” seems to agree with you, since he adds the following code to findSuccessor:

    if (this == successor) {
        return this;
    }
    

    But there seems to be a more elegant solution with is closer to the pseudo code. When checking if an ID is in the interval (n, successor] (left excluded, right included), make that check cyclic. jDHTUQ seems to do it like this (Starting at line 75. Warning: Really ugly code):

    http://jdhtuq.svn.sourceforge.net/viewvc/jdhtuq/source_code/distributed_lookup_service/LookupService/src/co/edu/uniquindio/utils/hashing/Key.java?revision=63&view=markup

    IMHO performing the interval check in a cyclic way seems to be the right thing to do. The paper you linked says (on page 4):

    The notation (a; b] denotes the segment of the Chord ring obtained by moving clockwise from (but not including) a until reaching (and including) b.

    In case of a single node, you would check if

    id is.in (n, n]
    

    which should yield true since the id is within the ring that starts right after n and ends with n.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently dealing with code where there is a singleton which is used
I am currently dealing with code purchased from a third party contractor. One struct
Currently I am dealing with a web application which uses a txt file as
I am currently dealing with two devices connected to the I2C bus within an
I am currently dealing with a script which make some checks & insertions for
Currently I am working on a bit of code which (I believe) requires quite
I compile C++ code with MinGW GCC on Windows. I'm currently dealing with a
i´m currently dealing with a system where i have to track the state for
currently, I`m implementing a map App with Mono4Droid and there I`m using a WebView
Currently I have 2 ways of displaying images in a cell, which way will

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.