An Example Architecture for CS179i based on Gnutella and Python

About This Presentation
Title:

An Example Architecture for CS179i based on Gnutella and Python

Description:

Norman Matloff's 'Introduction to Threads Programming with Python' ... be sent back along the same path that carried the orginal Ping/Query descriptors. ... –

Number of Views:76
Avg rating:3.0/5.0
Slides: 10
Provided by: yihu5
Learn more at: http://alumni.cs.ucr.edu
Category:

less

Transcript and Presenter's Notes

Title: An Example Architecture for CS179i based on Gnutella and Python


1
An Example Architecture for CS179ibased on
Gnutella and Python
  • Yihua He

2
Sources
  • Gnutella Protocol v0.4
  • Norman Matloffs Introduction to Threads
    Programming with Python
  • Gnutella Developers Forum (GDF)
  • Sources available online at www.cs.ucr.edu/yhe/cs
    179i
  • Trying to keep updated

3
Basic Components
  • A Gnutella Server
  • Setup and maintain connection with neighbors
  • Routing Pings/Pongs and Querys/QueryHits
  • A local searching mechanism
  • A Gnutella Client
  • Customized FTP/HTTP server and client for
    retrieving target files.

4
Data Structures Neighbor Table
  • NeighborTable
  • Fields IP, TimeStamp
  • Keep track of current active neighbors. Neighbors
    are supposed to send pings periodically in order
    to keep themselves active. Timeout neighbors will
    be deleted from NeighborTable.
  • RoutingHistory
  • FileSharingTable

5
Data Structures Neighbor Table
  • NeighborTable
  • Fields IP, TimeStamp
  • Keep track of current active neighbors. Neighbors
    are supposed to send pings periodically in order
    to keep themselves active. Timeout neighbors will
    be deleted from NeighborTable.
  • RoutingHistory
  • FileSharingTable

6
Data Structures RoutingHistory
  • NeighborTable
  • RoutingHistory
  • Fields DescriptionID, MsgType, SourceIP,
    Timestamp
  • Pong/QueryHit descriptors may only be sent back
    along the same path that carried the orginal
    Ping/Query descriptors.
  • To limit the size of RoutingHistory Table,
    entries will be deleted after a certain period of
    time (timeout Soft state)
  • FileSharingTable

7
Data StructuresFileSharing Table
  • NeighborTable
  • RoutingHistory
  • FileSharingTable
  • Fields FileID, FileName, FilePath,
    MetaDescription, FileSize, Date and so on
  • Includes the files a node willing to share
  • In QueryHit, a node only sends out FileID to
    its peer. The peer opens a customized FTP/HTTP
    connection to the node and retrieve target files
    by FileID

8
Main Loop
Listen for new connection requestGNUTELLA
CONNECT/0.4\n\n
If neighbor table full
N
Spawn a new thread to handle connection
Y
Send GNUTELLA NOT OK\n\nClose connection
9
Maintain and Routing
  • Process descriptions accordingly
  • Ping Response with a Pong withnodes
    information. Update routinghistory table, TTL-1
    and forwardPing to all neighbors if TTLgt0
  • Pong Check with routing historytable and if it
    is in, then TTL-1 and forward to its
    destination else discard
  • Query Search local file (File Sharing Table),
    if hit, send Query/Hit with FileID and
    otherinfo. Update routing history table,TTL-1
    and forward Queryto all neighbors if TTLgt0
  • QueryHit Check with routinghistory table and if
    it is in, thenTTL-1 and forward to
    itsdestination else discard

Re-check if neighbor table full
Put a new entry in NeighborTable Send GNUTELLA
OK\n\n
N
Y
Send GNUTELLA NOT OK\n\nClose
connectionThread ends
Listen for Description Head (23 bytes)
At any stage, if it timeouts or any unexpected
strings are received, the entry in NeighborTable
will be deleted, connection will be closed and
the thread ends
Write a Comment
User Comments (0)
About PowerShow.com