Hoist two calls from p2p -> client out of a loop iterating over all p2p connections to fix a crash when a peer disconnects while looping over the connections