Developers.FiguringOutCNeighbours
Figuring out CNeighbours
The next classes I'm going to explore are part of a daunting column of inheritance:
The classes are:
- Developers.Code.CNeighboursBase
- Developers.Code.CNeighboursWithG1
- Developers.Code.CNeighboursWithG2
- Developers.Code.CNeighboursWithED2K
- Developers.Code.CNeighboursWithRouting
- Developers.Code.CNeighboursWithConnect
- Developers.Code.CNeighbours
Developer ten9 has said that Shareaza never makes an object from CNeighboursWithG1 or CNeighboursWithRouting. The inheritance column is just about building up features and functionality for CNeighbours, from which objects are made. It's weird that Gnutella, Gnutella2, and eDonkey2000 are all in the chain. I think that Mike also has questioned this design.
Here's my initial survey of these classes:
CNeighboursBase
member variables like m_nLeafCount and m_nBandwidthIn methods like Connect, Close, OnRun, Add and Remove seems to be keeping a list of computers we are connected to
CNeighboursWithG1
adds member variables like m_pPongCache adds methods like OnG1Ping and OnG1Pong seems to be searching the list of connected computers to deal with Gnutella ping and pong packets
CNeighboursWithG2
doesn't add any member variables adds methods like CreateQueryWeb and GetRandomHub seems to be searching the list of connected computers to deal with Gnutella 2 packets
CNeighboursWithED2K
adds member variables like m_tEDSources adds methods like SendDonkeyDownload and PushDonkey seems to be searching the connected computer list, and then doing a task with the found computer
CNeighboursWithRouting
doesn't add any member variables adds just two methods, Broadcast and RouteQuery this must be where the program does packet routing
CNeighboursWithConnect
doesn't add any member variables adds methods like IsG1Leaf and IsG1UltrapeerCapable lots of code about hubs and leaves
CNeighbours
doesn't add any member variables defines virtual methods like Connect, Close and OnRun almost no code here, this seems to just be about how the inheritance works