Fix assert invariant in Peers::close_all

This commit is contained in:
Vinnie Falco
2014-04-01 10:24:55 -07:00
parent 30e882196f
commit f124a34730

View File

@@ -91,8 +91,6 @@ class PeersImp
public:
typedef std::unordered_map <PeerFinder::Slot::ptr,
boost::weak_ptr <PeerImp>> PeersBySlot;
typedef std::unordered_map <beast::IP::Endpoint,
boost::weak_ptr <PeerImp>> PeersByIP;
typedef boost::unordered_map <
RippleAddress, Peer::pointer> PeerByPublicKey;
@@ -489,8 +487,12 @@ public:
for (auto const& entry : m_peers)
{
PeerImp::ptr const peer (entry.second.lock());
assert (peer != nullptr);
peer->close (graceful);
// VFALCO The only case where the weak_ptr is expired should be if
// ~PeerImp is pre-empted before it calls m_peers.remove()
//
if (peer != nullptr)
peer->close (graceful);
}
}