Ok, so the other issue wasn't related to the MAID172 at the end. The real issue was that sometimes the ConnectionManager started two Connections to one endpoint at the same time: once from ConnectionManager::Connect and once from ConnectionManager::HandlePingFrom. These two connections were then interfering with each other resulting in undefined behavior.
What this pull request does, it makes the ConnectionManager remember to which endpoints we're currently connecting to prevent another connection being created at the same time.
It has one deficiency, that is, if the Connection fails, it won't let the ConnectionManager know about that fact so all subsequent attempts to connect to the same endpoint will fail. I'll continue working on it, but in the mean time, this makes the tests go green, so I created this pull request.
Ok, so the other issue wasn't related to the MAID172 at the end. The real issue was that sometimes the ConnectionManager started two Connections to one endpoint at the same time: once from ConnectionManager::Connect and once from ConnectionManager::HandlePingFrom. These two connections were then interfering with each other resulting in undefined behavior.
What this pull request does, it makes the ConnectionManager remember to which endpoints we're currently connecting to prevent another connection being created at the same time. It has one deficiency, that is, if the Connection fails, it won't let the ConnectionManager know about that fact so all subsequent attempts to connect to the same endpoint will fail. I'll continue working on it, but in the mean time, this makes the tests go green, so I created this pull request.