Gnutella Forums

Gnutella Forums (https://www.gnutellaforums.com/)
-   General Gnutella Development Discussion (https://www.gnutellaforums.com/general-gnutella-development-discussion/)
-   -   Why do we need TTL? (https://www.gnutellaforums.com/general-gnutella-development-discussion/6363-why-do-we-need-ttl.html)

Ivex December 12th, 2001 09:35 AM

Why do we need TTL?
 
I'm a newbie to gnutella and I wonder why we need TTL and how it works. Thanks!

Moak December 12th, 2001 05:43 PM

TTL, Hops and horizon
 
TTLs are used to limit message live time and broadcast.

TTL = Time to live. Each time a message is forwarded it's TTL is decremented by one. If a message has reached TTL=0 it is not send out to other servants. There is also a 'Hop' field in every message, it's a kind of reverse TTL field. Hops = Number of times a message has been forwarded.

Example: When you send out a search request, the TTL make sure it will be forwarded within the so called 'horizon' and then be stopped (the horizon is what you can reach with your TTL). Otherwise the message would be forwarded infinite and the broadcast traffic would be increased by every new message.
You are connected to, lets say, five hosts. Each of this hosts is connected to five hosts as well and so on ad infinitum. Now when you send a search request, it passes the first five hosts. Having done this, it will be forwarded to the hosts they are connected to (5x5=25), and then they will be forwarded again (5x5x5=125 hosts). Each step your message makes is called a "Hop". As we know each of your messages has a "Time to Live (TTL)" which is about 7 by most servents, but this is also servant dependent. After a hop the TTL is decreased by one, that means, your request will pass about seven levels of forwarding (also called "broadcasting"). The servents that your request is able to reach before it dies (that means its TTL has reached 0) is called your "Network Horizon". It depends on your TTL and the number of connections that you and each of your peers have.
In reality the message routing is slightly more complicated. A servant makes sure it does not send broadcasts back to every servant, not to those it has received the message from and also tries to avoid round trips. It is also very common to lower extraordinary high TTLs to something healthy (TTL<=7) while you route them. So misconfigured Gnutella clients can't flood the network. You find details in the Gnutella specification.

Hope it helps. :)
Some parts of this text taken from Gnutella protocoll and Abaris.

Unregistered January 3rd, 2002 01:56 PM

Just a side note. I haven't read the gnutella protocol yet - btu feel like I should comment on your post.

It the protocol both implementes TTL and HOP and TTL is decremented by 1 each HOP and HOP incremented... what's the use of TTL then?

TTL usually is a value in seconds and thereby relative to the package timestamp of sending.

The HOP should be sufficient for this use. Not to have clients search infinite and or make crazy round trips.

Maybe I have misunderstood the concept you just explained... if so - sorry for taking up your time ;)

// A-Vizion

cultiv8r January 4th, 2002 01:28 AM

Indeed, many would wonder why you'd have a TTL *and* a HOP count. But there's something you can't tell without the other: How far does it need to go, and how far away did it come from?

For TTL only: Where did the TTL start? Did it start with TTL of 7? Or a TTL of 255? I only see TTL = 2!

For Hops only: At which Hop count do I stop? At 3, 7, 100? Am I the first to see this message? The last?

There are cases where you need to know how far a message has traveled. For example, a PONG message with a TTL of 7 and a hop count of 0 most likely came from a node directly connected to you. You might need to correct the IP address in this PONG message before you pass it on. Also, you might want to prevent multiple PING messages within a short timespan from your direct connected node.

Now, your assumption that the TTL is the time in seconds is incorrect in terms of the Gnutella protocol. When you're talking about ICMP (Pings, traceroutes), yes, TTL would give you a timestamp. But with Gnutella, it is merely any given number, and at each node, this number is decreased.

-- Mike

Moak January 12th, 2002 01:03 AM

Question from yesterday on IRC...

Q: When do we throw away messages, TTL=0 or TTL=1?
A: Here is a little pseudo code:

if(ttl == 0) DropConnection(); //bad client, must not happen
ttl--; hop++;
if(ttl>0) message.DoForward(); //message routing
message.DoEvaluateAndResponse(); //work :-)

the_real_maniac November 23rd, 2003 01:57 AM

I have read many manual pages and HOWTOs, but I can't find any solution of my problem !?. :(

How to route packages with TTL=1 ?

10x in advance ...


All times are GMT -7. The time now is 05:24 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 ©2011, Crawlability, Inc.

Copyright © 2020 Gnutella Forums.
All Rights Reserved.