Developers.Code.CNeighboursWithG2

From Shareaza Wiki
Jump to navigation Jump to search

CNeighboursWithG2

In the middle of the CNeighbours inheritance column, CNeighboursWithG2 adds two member functions helpful for Gnutella2.

CreateQueryWeb

CreateQueryWeb puts together a Gnutella2 query web packet. It gathers up IP addresses of Gnutella2 computers we're connected to, and recent entries from the Gnutella2 host cache. It hands the packet to HubHorizonPool.AddHorizonHubs, and then returns it.

This method is called in 2 places: CDatagrams::OnQuery and CG2Neighbour::OnQuery.

GetRandomHub

GetRandomHub makes a list of all the Gnutella2 hubs we're connected to that don't know about a given GUID. Then, it randomly selects one of them from the list, and returns a pointer to it.

This method is only used one place, in CG2Neighbour::OnHAW.