Presentation is loading. Please wait.

Presentation is loading. Please wait.

In peer-to-peer networks such as gnutella, each host must search out other hosts. When a host finds another host, these hosts become neighbors. Often a.

Similar presentations


Presentation on theme: "In peer-to-peer networks such as gnutella, each host must search out other hosts. When a host finds another host, these hosts become neighbors. Often a."— Presentation transcript:

1 In peer-to-peer networks such as gnutella, each host must search out other hosts. When a host finds another host, these hosts become neighbors. Often a host will continue to search for peers until a sufficient number of hosts have been found. Lets assume that a host will continue to search for hosts until it has N neighbors. In this project, peer-to-peer neighborhoods are made and maintained. Each host maintains list of neighbors and sends hello packets to these neighbors every 10 seconds. If a host is on the neighbor list, and no hello packet is received from the host for 40 seconds, then this host is removed from the neighbor list. If a node does not have enough neighbors, then it selects an address (e.g., IP and port) at random and tries to become its neighbor.

2 Objectives Find N neighbors Maintain N neighbors
A node is a neighbor if two-way communication is possible and verified Two-communication == bidirectional link Maintain N neighbors If two-way communication is no longer verified, the node is no longer a neighbor

3 Detecting Bidirectional Links
Node A has a bidirectional with node B if Node A can hear node B Node B can hear node A To determine if a link between node A and B is bidirectional Node A sends a message to node B Node B sends a message to node A saying that it can hear node A Now node A believes the link is bidirectional Node A sends a message to node B saying that it can hear node B Now node B believes the link is bidirectional In general, to determine is links are bidirectional Send hello messages where the message includes a list of all nodes that have been heard Upon receiving a hello message, If you are listed as one of the nodes that has been recently heard, then the link is bidirectional Add the sender of the hello to the list of nodes that you can hear

4 I am A I have heard: no one A B Have heard list Have heard list

5 I am A I have heard: no one A B Have heard list Have heard list A

6 I am B I have heard: A A B Have heard list Have heard list A

7 A B A I am B I have heard: A Have heard list Have heard list
B and B hears me A

8 A B A I am A I have heard: B Have heard list Have heard list
B and B hears me A

9 A B I am A I have heard: B, C, D Have heard list Have heard list
B and B hears me A and A hears me

10 List unidirectionalNeighbors bidirectionalNeighbors
A neighbor can be in at most one list (we could allow a neighbor to be in both, but let’s not do it that way)

11 A B I am A I have heard: no one Have heard list Have heard list
Unidirectional Neighbors Bidirectional Neighbors Unidirectional Neighbors Bidirectional Neighbors

12 A B A A I am A I have heard: no one Have heard list Have heard list
Unidirectional Neighbors Bidirectional Neighbors Unidirectional Neighbors Bidirectional Neighbors A

13 A B A A I am B I have heard: A Have heard list Have heard list
Unidirectional Neighbors Bidirectional Neighbors Unidirectional Neighbors Bidirectional Neighbors A

14 A B A B A I am B I have heard: A Have heard list Have heard list
B and B hears me A Unidirectional Neighbors Bidirectional Neighbors Unidirectional Neighbors Bidirectional Neighbors B A

15 A B A B A I am A I have heard: B Have heard list Have heard list
B and B hears me A Unidirectional Neighbors Bidirectional Neighbors Unidirectional Neighbors Bidirectional Neighbors B A

16 A B B A I am A I have heard: B, C, D Have heard list Have heard list
B and B hears me A and A hears me Unidirectional Neighbors Bidirectional Neighbors Unidirectional Neighbors Bidirectional Neighbors B A

17 Let’s try to make pseudo code

18 A B I am A I have heard: no one Have heard list Have heard list
Unidirectional Neighbors Bidirectional Neighbors Unidirectional Neighbors Bidirectional Neighbors

19 A B A A I am A I have heard: no one Have heard list Have heard list
Received message from A if thisHost is in the helloMessage’s list of neighbors isBidirectional = True else isBidirectional = False Add A to list of unidirectional neighbors Q: Why did we add A to the list of unidirectional neighbors and not the list of bidirectional neighbors? A: Because A has not heard any messages from B A: The hello message from A did not include B I am A I have heard: no one A B Have heard list Have heard list A Unidirectional Neighbors Bidirectional Neighbors Unidirectional Neighbors Bidirectional Neighbors A

20 A B A A A I am A I have heard: no one Have heard list Have heard list
Received message from A if thisHost is in the helloMessage’s list of neighbors isBidirectional = True else isBidirectional = False if (isBidirectional == False) Add A to list of unidirectional neighbors Q: Why did we add A to the list of unidirectional neighbors and not the list of bidirectional neighbors? A: Because A has not heard any messages from B A: The hello message from A did not include B I am A I have heard: no one A B Have heard list Have heard list A Unidirectional Neighbors Bidirectional Neighbors Unidirectional Neighbors Bidirectional Neighbors A A

21 A B A A I am A I have heard: no one Have heard list Have heard list
Received message from A if thisHost is in the helloMessage’s list of neighbors isBidirectional = True else isBidirectional = False if (isBidirectional == False) Add A to list of unidirectional neighbors, if not already in that list Q: Why did we add A to the list of unidirectional neighbors and not the list of bidirectional neighbors? A: Because A has not heard any messages from B A: The hello message from A did not include B I am A I have heard: no one A B Have heard list Have heard list A Unidirectional Neighbors Bidirectional Neighbors Unidirectional Neighbors Bidirectional Neighbors A

22 A B A A I am A I have heard: no one Have heard list Have heard list
Received message from A if thisHost is in the helloMessage’s list of neighbors isBidirectional = True else isBidirectional = False if (isBidirectional == False) Add source of hello message to list of unidirectional neighbors, if not already in that list Q: Why did we add A to the list of unidirectional neighbors and not the list of bidirectional neighbors? A: Because A has not heard any messages from B A: The hello message from A did not include B I am A I have heard: no one A B Have heard list Have heard list A Unidirectional Neighbors Bidirectional Neighbors Unidirectional Neighbors Bidirectional Neighbors A

23 A B A A I am B I have heard: A Have heard list Have heard list
Received message from A if thisHost is in the helloMessage’s list of neighbors isBidirectional = True else isBidirectional = False if (isBidirectional == False) Add source of hello message to list of unidirectional neighbors, if not already in that list I am B I have heard: A A B Have heard list Have heard list A Unidirectional Neighbors Bidirectional Neighbors Unidirectional Neighbors Bidirectional Neighbors A

24 A B A B A I am B I have heard: A Have heard list Have heard list
Received message from A if thisHost is in the helloMessage’s list of neighbors isBidirectional = True else isBidirectional = False if (isBidirectional == False) Add source of hello message to list of unidirectional neighbors, if not already in that list if (isBidirectional == True) Add source of hello message to list of bidirectional neighbors, if not already in that list I am B I have heard: A A B Have heard list Have heard list B and B hears me A Unidirectional Neighbors Bidirectional Neighbors Unidirectional Neighbors Bidirectional Neighbors B A

25 A B A B A I am A I have heard: B Have heard list Have heard list
Received message from A if thisHost is in the helloMessage’s list of neighbors isBidirectional = True else isBidirectional = False if (isBidirectional == False) Add source of hello message to list of unidirectional neighbors, if not already in that list if (isBidirectional == True) Add source of hello message to list of bidirectional neighbors, if not already in that list I am A I have heard: B A B Have heard list Have heard list B and B hears me A Unidirectional Neighbors Bidirectional Neighbors Unidirectional Neighbors Bidirectional Neighbors B A

26 A B B A I am A I have heard: B, C, D Have heard list Have heard list
Received message from A if thisHost is in the helloMessage’s list of neighbors isBidirectional = True else isBidirectional = False if (isBidirectional == False) Add source of hello message to list of unidirectional neighbors, if not already in that list if (isBidirectional == True) Add source of hello message to list of bidirectional neighbors, if not already in that list No, this does not move A to the other list, it would just add it to the bidirectional neighbor’s list I am A I have heard: B, C, D A B Have heard list Have heard list B and B hears me A and A hears me Unidirectional Neighbors Bidirectional Neighbors Unidirectional Neighbors Bidirectional Neighbors B A

27 A B B A I am A I have heard: B, C, D Have heard list Have heard list
Received message from A if thisHost is in the helloMessage’s list of neighbors isBidirectional = True else isBidirectional = False if (isBidirectional == False) Add source of hello message to list of unidirectional neighbors, if not already in that list if (isBidirectional == True) Add source of hello message to list of bidirectional neighbors, if not already in that list Remove source from list of unidirectional neighbor No, this does not move A to the other list, it would just add it to the bidirectional neighbor’s list This fixes it I am A I have heard: B, C, D A B Have heard list Have heard list B and B hears me A and A hears me Unidirectional Neighbors Bidirectional Neighbors Unidirectional Neighbors Bidirectional Neighbors B A

28 Received message from A
if thisHost is in the helloMessage’s list of neighbors isBidirectional = True else isBidirectional = False if (isBidirectional == False) Add source of hello message to list of unidirectional neighbors, if not already in that list if (isBidirectional == True) Add source of hello message to list of bidirectional neighbors, if not already in that list Remove source from list of unidirectional neighbor Warning: There are some more steps to processing newly received hello messages. We’ll cover them later No, this does not move A to the other list, it would just add it to the bidirectional neighbor’s list This fixes it I am A I have heard: B, C, D A B Have heard list Have heard list B and B hears me A and A hears me Unidirectional Neighbors Bidirectional Neighbors Unidirectional Neighbors Bidirectional Neighbors B A


Download ppt "In peer-to-peer networks such as gnutella, each host must search out other hosts. When a host finds another host, these hosts become neighbors. Often a."

Similar presentations


Ads by Google