mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-26 14:05:51 +00:00
Fix a deadlock.
This commit is contained in:
@@ -155,8 +155,6 @@ void LedgerMaster::storeLedger (Ledger::pointer ledger)
|
|||||||
|
|
||||||
if (ledger->isAccepted ())
|
if (ledger->isAccepted ())
|
||||||
mLedgerHistory.addAcceptedLedger (ledger, false);
|
mLedgerHistory.addAcceptedLedger (ledger, false);
|
||||||
|
|
||||||
checkAccept (ledger->getHash(), ledger->getLedgerSeq());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Ledger::pointer LedgerMaster::closeLedger (bool recover)
|
Ledger::pointer LedgerMaster::closeLedger (bool recover)
|
||||||
|
|||||||
@@ -236,6 +236,9 @@ static void LADispatch (
|
|||||||
InboundLedger::pointer la,
|
InboundLedger::pointer la,
|
||||||
std::vector< FUNCTION_TYPE<void (InboundLedger::pointer)> > trig)
|
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)
|
for (unsigned int i = 0; i < trig.size (); ++i)
|
||||||
trig[i] (la);
|
trig[i] (la);
|
||||||
}
|
}
|
||||||
@@ -273,9 +276,9 @@ void InboundLedger::done ()
|
|||||||
else
|
else
|
||||||
getApp().getInboundLedgers ().logFailure (mHash);
|
getApp().getInboundLedgers ().logFailure (mHash);
|
||||||
|
|
||||||
if (!triggers.empty ()) // We hold the PeerSet lock, so must dispatch
|
// We hold the PeerSet lock, so must dispatch
|
||||||
getApp().getJobQueue ().addJob (jtLEDGER_DATA, "triggers",
|
getApp().getJobQueue ().addJob (jtLEDGER_DATA, "triggers",
|
||||||
BIND_TYPE (LADispatch, P_1, shared_from_this (), triggers));
|
BIND_TYPE (LADispatch, P_1, shared_from_this (), triggers));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool InboundLedger::addOnComplete (FUNCTION_TYPE<void (InboundLedger::pointer)> trigger)
|
bool InboundLedger::addOnComplete (FUNCTION_TYPE<void (InboundLedger::pointer)> trigger)
|
||||||
|
|||||||
@@ -225,16 +225,21 @@ int InboundLedgers::getFetchCount (int& timeoutCount)
|
|||||||
{
|
{
|
||||||
timeoutCount = 0;
|
timeoutCount = 0;
|
||||||
int ret = 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::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;
|
return ret;
|
||||||
|
|||||||
Reference in New Issue
Block a user