mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-23 04:25:51 +00:00
Fix a deadlock.
This commit is contained in:
@@ -155,8 +155,6 @@ void LedgerMaster::storeLedger (Ledger::pointer ledger)
|
||||
|
||||
if (ledger->isAccepted ())
|
||||
mLedgerHistory.addAcceptedLedger (ledger, false);
|
||||
|
||||
checkAccept (ledger->getHash(), ledger->getLedgerSeq());
|
||||
}
|
||||
|
||||
Ledger::pointer LedgerMaster::closeLedger (bool recover)
|
||||
|
||||
@@ -236,6 +236,9 @@ static void LADispatch (
|
||||
InboundLedger::pointer la,
|
||||
std::vector< FUNCTION_TYPE<void (InboundLedger::pointer)> > trig)
|
||||
{
|
||||
Ledger::ref ledger = la->getLedger();
|
||||
if (ledger)
|
||||
getApp().getLedgerMaster().checkAccept (ledger->getHash(), ledger->getLedgerSeq());
|
||||
for (unsigned int i = 0; i < trig.size (); ++i)
|
||||
trig[i] (la);
|
||||
}
|
||||
@@ -273,9 +276,9 @@ void InboundLedger::done ()
|
||||
else
|
||||
getApp().getInboundLedgers ().logFailure (mHash);
|
||||
|
||||
if (!triggers.empty ()) // We hold the PeerSet lock, so must dispatch
|
||||
getApp().getJobQueue ().addJob (jtLEDGER_DATA, "triggers",
|
||||
BIND_TYPE (LADispatch, P_1, shared_from_this (), triggers));
|
||||
// We hold the PeerSet lock, so must dispatch
|
||||
getApp().getJobQueue ().addJob (jtLEDGER_DATA, "triggers",
|
||||
BIND_TYPE (LADispatch, P_1, shared_from_this (), triggers));
|
||||
}
|
||||
|
||||
bool InboundLedger::addOnComplete (FUNCTION_TYPE<void (InboundLedger::pointer)> trigger)
|
||||
|
||||
@@ -225,16 +225,21 @@ int InboundLedgers::getFetchCount (int& timeoutCount)
|
||||
{
|
||||
timeoutCount = 0;
|
||||
int ret = 0;
|
||||
|
||||
std::map<uint256, InboundLedger::pointer> inboundLedgers;
|
||||
|
||||
{
|
||||
typedef std::pair<uint256, InboundLedger::pointer> u256_acq_pair;
|
||||
boost::mutex::scoped_lock sl (mLock);
|
||||
BOOST_FOREACH (const u256_acq_pair & it, mLedgers)
|
||||
inboundLedgers = mLedgers;
|
||||
}
|
||||
|
||||
typedef std::pair<uint256, InboundLedger::pointer> u256_acq_pair;
|
||||
BOOST_FOREACH (const u256_acq_pair & it, inboundLedgers)
|
||||
{
|
||||
if (it.second->isActive ())
|
||||
{
|
||||
if (it.second->isActive ())
|
||||
{
|
||||
++ret;
|
||||
timeoutCount += it.second->getTimeouts ();
|
||||
}
|
||||
++ret;
|
||||
timeoutCount += it.second->getTimeouts ();
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
|
||||
Reference in New Issue
Block a user