Right now, there is a single ProcessMessages handler (which is somewhat pluggable through the use of boost::signals2), but it still implies:
- A single method needing to deal with everything.
- Only a single network handler thread (because it assumes everything needs cs_main anyway).
- No way to process messages asynchronously (we want to process everything from a single peer in-order, but there is no need why a
pongreply to peer B'spingneeds to wait while we're waiting for the hard disk to find a block in response to peer A'sgetdata).
So, what I would like is pluggable modules that can independently install handlers for specific network messages, that can have independent state, and can run independently and asynchronously, while still maintaining the guarantee that a single peer's messages are always processed in-order.
I'll try to post an idea for a design soon.