mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-24 04:55:52 +00:00
Remove some shared pointers on load monitors.
This commit is contained in:
@@ -61,7 +61,7 @@ void HashedObjectStore::waitWrite()
|
|||||||
|
|
||||||
void HashedObjectStore::bulkWrite()
|
void HashedObjectStore::bulkWrite()
|
||||||
{
|
{
|
||||||
LoadEvent::pointer event = theApp->getJobQueue().getLoadEvent(jtDISK);
|
LoadEvent::autoptr event(theApp->getJobQueue().getLoadEventAP(jtDISK));
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
std::vector< boost::shared_ptr<HashedObject> > set;
|
std::vector< boost::shared_ptr<HashedObject> > set;
|
||||||
|
|||||||
@@ -104,6 +104,8 @@ public:
|
|||||||
|
|
||||||
LoadEvent::pointer getLoadEvent(JobType t)
|
LoadEvent::pointer getLoadEvent(JobType t)
|
||||||
{ return boost::make_shared<LoadEvent>(boost::ref(mJobLoads[t]), true, 1); }
|
{ return boost::make_shared<LoadEvent>(boost::ref(mJobLoads[t]), true, 1); }
|
||||||
|
LoadEvent::autoptr getLoadEventAP(JobType t)
|
||||||
|
{ return LoadEvent::autoptr(new LoadEvent(mJobLoads[t], true, 1)); }
|
||||||
|
|
||||||
Json::Value getJson(int c = 0);
|
Json::Value getJson(int c = 0);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -339,9 +339,8 @@ uint256 Ledger::getHash()
|
|||||||
return mHash;
|
return mHash;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ledger::saveAcceptedLedger(bool fromConsensus)
|
void Ledger::saveAcceptedLedger(bool fromConsensus, LoadEvent::pointer event)
|
||||||
{ // can be called in a different thread
|
{ // can be called in a different thread
|
||||||
LoadEvent::pointer event = theApp->getJobQueue().getLoadEvent(jtDISK);
|
|
||||||
cLog(lsTRACE) << "saveAcceptedLedger " << (fromConsensus ? "fromConsensus " : "fromAcquire ") << getLedgerSeq();
|
cLog(lsTRACE) << "saveAcceptedLedger " << (fromConsensus ? "fromConsensus " : "fromAcquire ") << getLedgerSeq();
|
||||||
static boost::format ledgerExists("SELECT LedgerSeq FROM Ledgers where LedgerSeq = %d;");
|
static boost::format ledgerExists("SELECT LedgerSeq FROM Ledgers where LedgerSeq = %d;");
|
||||||
static boost::format deleteLedger("DELETE FROM Ledgers WHERE LedgerSeq = %d;");
|
static boost::format deleteLedger("DELETE FROM Ledgers WHERE LedgerSeq = %d;");
|
||||||
@@ -439,7 +438,7 @@ void Ledger::saveAcceptedLedger(bool fromConsensus)
|
|||||||
}
|
}
|
||||||
|
|
||||||
theApp->getLedgerMaster().setFullLedger(shared_from_this());
|
theApp->getLedgerMaster().setFullLedger(shared_from_this());
|
||||||
event = LoadEvent::pointer();
|
event->stop();
|
||||||
|
|
||||||
theApp->getOPs().pubLedger(shared_from_this());
|
theApp->getOPs().pubLedger(shared_from_this());
|
||||||
|
|
||||||
@@ -1136,7 +1135,8 @@ void Ledger::pendSave(bool fromConsensus)
|
|||||||
if (!fromConsensus && !theApp->isNewFlag(getHash(), SF_SAVED))
|
if (!fromConsensus && !theApp->isNewFlag(getHash(), SF_SAVED))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
boost::thread thread(boost::bind(&Ledger::saveAcceptedLedger, shared_from_this(), fromConsensus));
|
boost::thread thread(boost::bind(&Ledger::saveAcceptedLedger, shared_from_this(),
|
||||||
|
fromConsensus, theApp->getJobQueue().getLoadEvent(jtDISK)));
|
||||||
thread.detach();
|
thread.detach();
|
||||||
|
|
||||||
boost::recursive_mutex::scoped_lock sl(sPendingSaveLock);
|
boost::recursive_mutex::scoped_lock sl(sPendingSaveLock);
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
#include "BitcoinUtil.h"
|
#include "BitcoinUtil.h"
|
||||||
#include "SHAMap.h"
|
#include "SHAMap.h"
|
||||||
#include "InstanceCounter.h"
|
#include "InstanceCounter.h"
|
||||||
|
#include "LoadMonitor.h"
|
||||||
|
|
||||||
enum LedgerStateParms
|
enum LedgerStateParms
|
||||||
{
|
{
|
||||||
@@ -93,7 +94,7 @@ protected:
|
|||||||
|
|
||||||
static void incPendingSaves();
|
static void incPendingSaves();
|
||||||
static void decPendingSaves();
|
static void decPendingSaves();
|
||||||
void saveAcceptedLedger(bool fromConsensus);
|
void saveAcceptedLedger(bool fromConsensus, LoadEvent::pointer);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Ledger(const RippleAddress& masterID, uint64 startAmount); // used for the starting bootstrap ledger
|
Ledger(const RippleAddress& masterID, uint64 startAmount); // used for the starting bootstrap ledger
|
||||||
|
|||||||
@@ -36,7 +36,8 @@ public:
|
|||||||
class LoadEvent
|
class LoadEvent
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef boost::shared_ptr<LoadEvent> pointer;
|
typedef boost::shared_ptr<LoadEvent> pointer;
|
||||||
|
typedef std::auto_ptr<LoadEvent> autoptr;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
LoadMonitor& mMonitor;
|
LoadMonitor& mMonitor;
|
||||||
|
|||||||
@@ -1002,7 +1002,7 @@ void NetworkOPs::pubLedger(Ledger::ref lpAccepted)
|
|||||||
if (NetworkOPs::omDISCONNECTED == getOperatingMode())
|
if (NetworkOPs::omDISCONNECTED == getOperatingMode())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
LoadEvent::pointer event = theApp->getJobQueue().getLoadEvent(jtPUBLEDGER);
|
LoadEvent::autoptr event(theApp->getJobQueue().getLoadEventAP(jtPUBLEDGER));
|
||||||
|
|
||||||
{
|
{
|
||||||
boost::recursive_mutex::scoped_lock sl(mMonitorLock);
|
boost::recursive_mutex::scoped_lock sl(mMonitorLock);
|
||||||
|
|||||||
@@ -373,7 +373,7 @@ void Peer::processReadBuffer()
|
|||||||
|
|
||||||
// std::cerr << "Peer::processReadBuffer: " << mIpPort.first << " " << mIpPort.second << std::endl;
|
// std::cerr << "Peer::processReadBuffer: " << mIpPort.first << " " << mIpPort.second << std::endl;
|
||||||
|
|
||||||
LoadEvent::pointer event = theApp->getJobQueue().getLoadEvent(jtPEER);
|
LoadEvent::autoptr event(theApp->getJobQueue().getLoadEventAP(jtPEER));
|
||||||
|
|
||||||
boost::recursive_mutex::scoped_lock sl(theApp->getMasterLock());
|
boost::recursive_mutex::scoped_lock sl(theApp->getMasterLock());
|
||||||
|
|
||||||
|
|||||||
@@ -1482,7 +1482,7 @@ Json::Value RPCHandler::doCommand(const std::string& command, Json::Value& param
|
|||||||
cLog(lsTRACE) << "RPC:" << command;
|
cLog(lsTRACE) << "RPC:" << command;
|
||||||
cLog(lsTRACE) << "RPC params:" << params;
|
cLog(lsTRACE) << "RPC params:" << params;
|
||||||
|
|
||||||
LoadEvent::pointer le = theApp->getJobQueue().getLoadEvent(jtRPC);
|
LoadEvent::autoptr le(theApp->getJobQueue().getLoadEventAP(jtRPC));
|
||||||
|
|
||||||
mRole = role;
|
mRole = role;
|
||||||
|
|
||||||
|
|||||||
@@ -289,7 +289,7 @@ void ValidationCollection::condWrite()
|
|||||||
|
|
||||||
void ValidationCollection::doWrite()
|
void ValidationCollection::doWrite()
|
||||||
{
|
{
|
||||||
LoadEvent::pointer event = theApp->getJobQueue().getLoadEvent(jtDISK);
|
LoadEvent::autoptr event(theApp->getJobQueue().getLoadEventAP(jtDISK));
|
||||||
static boost::format insVal("INSERT INTO LedgerValidations "
|
static boost::format insVal("INSERT INTO LedgerValidations "
|
||||||
"(LedgerHash,NodePubKey,Flags,SignTime,Signature) VALUES ('%s','%s','%u','%u',%s);");
|
"(LedgerHash,NodePubKey,Flags,SignTime,Signature) VALUES ('%s','%s','%u','%u',%s);");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user