I have been steadily simplifying LocalPeer in my latest patches. Simplifying means putting code in another class/component, which is responsible for that specific task. We end up with a design that consists of a number of components interacting with each other to accomplish the tasks of its container. LocalPeer’s constructor just connects the signals and slots of ConnectionKeeper, SlotAllocator, Handshaker, PacketProcessor and NodeModel and that’s it (check LocalPeer.cpp)!
There is one more task, which should get a separate class – maybe called ConnectionAcceptor. We need a component, which listens on a TCP and an UDP port, accepts the incoming connections and forwards them to the next component in the control chain. For example, after accepting a TCP connection, the ConnectionAcceptor would check the first few bytes to see whether this is a Gnutella or an HTTP connection and emit the corresponding signals (eventually processed by SlotAllocator and TransferManager). Similarly, after receiving a UDP ping packet from a specific host, a new UdpConnection will be created and the UdpHostCache will take care of the rest.
In this patch I also removed ConnectionId from all signals and slots. I either replaced it with Connection * or deleted it altogether. I think soon it will completely be phased out.
To get Calitko displaying the nodes I had to do some fast hacks in NodeModel but it should be refactored anyway.
Committed in revision 8.
