PeerManagerImpl::SendMessages() is a ~500-line function handling every p2p conditional send message type inline, which makes it hard to navigate and review. This was reduced to less than 90 lines.
I've identified this issue/ possible improvement while reviewing #34824.
-Notes:
First (prepare) commit removes the unnecessary __func__ prefix from the debug logs in SendMessages(), as suggested by maflcko. The logging macros already capture the calling function via SourceLocation, available on demand with -logsourcelocations.
Each of the following 17 commits represents a helper function extraction so it can be easily reviewed, it's only a pure code move, the only new lines are the declaration (with thread-safety annotations), the function signature, and the one-line call site, and they can be reviewed with the git options: --color-moved=dimmed-zebra --color-moved-ws=ignore-all-space.
One final cleanup commit normalises formatting and simplifies some of the extracted helpers, preserving existing control flow and lock scopes.