Instead of using a 100ms sleep in the condition variable, this changes it to sleep for 100ms after the loop started, so if the loop takes a long time (e.g. due to waiting on the vnodes lock at the end) it will restart sooner.
Also avoids a potential 100ms delay before announcing a new block that arrived via submitblock, prevents delays in processing messages for early peers when they arrive part way through the message handler loop, and reruns the message handler when some peers don’t finish sendmessages due to contention for cs_main.
The final commit changes the message handling to only hold cs_vRecvMsg long enough to move out the message. This speeds up IBD up to 200k from a single peer over GbE compared to master by about 200%, by eliminating cs_vRecvMsg contention (that the prior commits happened to also make worse). With this change on both sides the speedup is ~3.2x.