mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Fix a crash bug reported by Jon Montroll.
ConnectionPool::peerConnect called Peer::connect while holding the ConnectionPool::mPeerLock. But Peer::connect could call Peer::detach which calls ConnectionPool::peerClosed which tries to acquire the ConnectionPool::mPeerLock mutex. Said mutex was not recursive. Belt and suspenders fix -- make the mutex recursive and make ConnectionPool::peerConnection call Peer::connect without holding the ConnectionPool::mPeerLock mutex. (This was intended to be a fast, internal mutex and calls to external 'heavy' functions should not be made while holding it.)
This commit is contained in:
@@ -16,8 +16,8 @@
|
||||
class ConnectionPool
|
||||
{
|
||||
private:
|
||||
boost::mutex mPeerLock;
|
||||
uint64 mLastPeer;
|
||||
boost::recursive_mutex mPeerLock;
|
||||
uint64 mLastPeer;
|
||||
|
||||
typedef std::pair<RippleAddress, Peer::pointer> naPeer;
|
||||
typedef std::pair<ipPort, Peer::pointer> pipPeer;
|
||||
|
||||
Reference in New Issue
Block a user