Developers.Code.CNeighboursWithRouting: Difference between revisions

From Shareaza Wiki
Jump to navigation Jump to search
(Importing page from Tikiwiki)
 
m (1 revision)
 

Latest revision as of 20:07, 20 June 2009

CNeighboursWithRouting

When Shareaza runs, it connects to a handful of computers on the Internet. They are all running different kinds of peer-to-peer software. Often, our copy of Shareaza here will get a packet from one computer, and need to pass it on to all the other computers. This is called packet routing, and the methods in CNeighboursWithRouting do it.

Broadcast

The method Broadcast takes a CNeighbour pointer called pExcept. This is the neighbour that we got the packet from. It wouldn't make any sense to send the packet back where we got it from, so the caller tells us to except this neighbour.

Broadcast takes a packet. It loops down the CNeighbours list of connected computers, and sends the packet to each one.

RouteQuery

RouteQuery takes a CPacket object along with a CQuerySearch one. If it is given a Gnutella packet and comes to a Gnutella2 computer in the list, it converts it into a Gnutella2 packet and sends it. It can also convert a Gnutella2 query into a Gnutella packet for a Gnutella computer.

Both Broadcast and RouteQuery return the number of connected computers they passed the given packet along to.