Do the tryLocal/addPeers operations on an InboundLedger without the collection lock.

This commit is contained in:
David Schwartz
2013-10-03 16:36:33 -07:00
parent b3b22d7595
commit 647c0e302a
4 changed files with 24 additions and 17 deletions

View File

@@ -48,22 +48,7 @@ InboundLedger::pointer InboundLedgers::findCreate (uint256 const& hash, uint32 s
ret = boost::make_shared<InboundLedger> (hash, seq);
assert (ret);
mLedgers.insert (std::make_pair (hash, ret));
if (!ret->tryLocal())
{
ret->addPeers ();
ret->setTimer (); // Cannot call in constructor
}
else if (!ret->isFailed ())
{
WriteLog (lsDEBUG, InboundLedger) << "Acquiring ledger we already have locally: " << hash;
Ledger::pointer ledger = ret->getLedger ();
ledger->setClosed ();
ledger->setImmutable ();
getApp().getLedgerMaster ().storeLedger (ledger);
if (couldBeNew)
getApp().getLedgerMaster().checkAccept(ledger);
}
ret->init (sl, couldBeNew);
}
}
}