Until now PongCache used to extract the NodeInfo from each pong and added it to NodeCache. As of this patch, this is a responsibility of NodeCache. I added a slot, which is connected to PacketProcessor::receivedPong(). The reason is that when we (soon) add UHC support, we will not have to duplicate the code, which extracts the node info. Instead, we can connect the NodeCache::processPong() slot to UdpHostCache::receivedPong().
Some may have noticed that there were two NodeInfo classes: Gnutella::NodeInfo (actually a struct) and Gnutella::Bootstrapping::NodeInfo. The latter is not there anymore and some of its fields were moved to the struct. I also added a default constructor, so that all fields will be initialized with suitable values. The format of hosts.dat is thus also changed, so please either delete the old file, or overwrite it with the one in the bzr repository!
I did slightly improve the algorithm in ConnectionKeeper::keepConnection(). I was wondering why after running for about half a day, Calitko would not establish a new connection after one is dropped. It would try to get a host with unknown availability and try it but there were none in the cache. Now it tries nodes with unknown availability first, then available hosts, then busy ones.
Additionally, the function extracting the node info checks whether the hops value is zero (meaning the pong came from a directly connected neighbor). If it was zero, the node should have been marked as available. Otherwise, it should have been marked with unknown availability. The bug was that it actually did exactly the opposite! This caused the odd behavior described above.
This patch is based on revision 6 and is applied in revision 7.
