HopLimit value

HopLimit value

by Peter Krcmar -
Number of replies: 2

Hi !

In hw1 the way I understood the HopLimit was that we initialize it to 10, decrement it and then send it since the handout said this:

Every node on the forwarding path (including the source peer) will first decrement this value and either forward the message...

However now with all the other messages using the HopLimit field I'm starting to doubt myself, since the HopLimit is supposed to represent how far a message can reach. So my question is should a newly generated messages's HopLimit really be decremented by the source or not? Or simply, is the message sent with HopLimit = 10 or HopLimit = 9 ?

Thanks :)

In reply to Peter Krcmar

Re: HopLimit value

by Kirill Nikitin -


We indeed expect you to decrement the HopLimit at source. In your example, when a message leaves the node, HopLimit = 9.

The general idea of the hop limit is indeed how far a message should be able to reach. So if one assigns the hop limit of 1 to a message, the logical behaviour is that the message propagates to another node and stops there. Now, it is up to the protocol design how to exactly define the numbers because, in the end, it is the combination of what value to use when sending and of what value signals that it is time to stop propagation that define the behaviour. In our protocol, we ask you to decrement the hop limit at the source and stop propagating when the hop limit of the received message is zero (but this message is still processed). Coming back to the example of the assigned hop limit of 1, the message would leave the source node with HopLimit = 0, would be processed / indexed by the receiving node and would stop propagating there.

I hope this helps!