Before anything else: If you want a scaleable network, please use Gnutella 0.6.
- Short reasoning why it scales:
Why Gnutella scales quite well - Gnufu
- Principles behind it:
Gnutella for Users - Gnufu
- Specification:
GDF - LimeWire
In Gnutella we don't use a dedicated island-avoidance-algorithm, since that would require knowledge about the whole network.
Instead we now have high-outdegree (32 connections per ultrapeer) which makes islands _very improbable_.
And if you don't implement strong connection preferencing, the experience in real usage shows that islands aren't a big problem.
But Gnutella 0.6 offers some ways which could be used for island detection. For example disconnecting, when you get your own queries back with only marginally higher hops (that's loop avoidance which leads to a better connectivity and has the sideeffect of making islands less probable, and avoiding small islands altogether).
One major problem with island detection is that a Gnutella client must not completely trust any other Gnutella client (it's an open network, and any possible exploits will be exploited someday), so it must not use unsure information for critical algorithms.
For an implementation of Gnutella 0.6 in C/C++ please have a look at gtk-gnutella:
http://gtk-gnutella.sf.net