mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-28 23:15:52 +00:00
Make amendment blocked state thread-safe & simplify a constructor.
This commit is contained in:
committed by
Nik Bougalis
parent
98d7fa3fd9
commit
be1f734845
@@ -193,8 +193,6 @@ public:
|
||||
, m_journal (journal)
|
||||
, m_localTX (make_LocalTxs ())
|
||||
, mMode (start_valid ? omFULL : omDISCONNECTED)
|
||||
, mNeedNetworkLedger (false)
|
||||
, m_amendmentBlocked (false)
|
||||
, heartbeatTimer_ (io_svc)
|
||||
, clusterTimer_ (io_svc)
|
||||
, mConsensus (app,
|
||||
@@ -210,7 +208,6 @@ public:
|
||||
, m_job_queue (job_queue)
|
||||
, m_standalone (standalone)
|
||||
, m_network_quorum (start_valid ? 0 : network_quorum)
|
||||
, accounting_ ()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -338,23 +335,23 @@ public:
|
||||
|
||||
void needNetworkLedger () override
|
||||
{
|
||||
mNeedNetworkLedger = true;
|
||||
needNetworkLedger_ = true;
|
||||
}
|
||||
void clearNeedNetworkLedger () override
|
||||
{
|
||||
mNeedNetworkLedger = false;
|
||||
needNetworkLedger_ = false;
|
||||
}
|
||||
bool isNeedNetworkLedger () override
|
||||
{
|
||||
return mNeedNetworkLedger;
|
||||
return needNetworkLedger_;
|
||||
}
|
||||
bool isFull () override
|
||||
{
|
||||
return !mNeedNetworkLedger && (mMode == omFULL);
|
||||
return !needNetworkLedger_ && (mMode == omFULL);
|
||||
}
|
||||
bool isAmendmentBlocked () override
|
||||
{
|
||||
return m_amendmentBlocked;
|
||||
return amendmentBlocked_;
|
||||
}
|
||||
void setAmendmentBlocked () override;
|
||||
void consensusViewChange () override;
|
||||
@@ -548,8 +545,8 @@ private:
|
||||
|
||||
std::atomic<OperatingMode> mMode;
|
||||
|
||||
std::atomic <bool> mNeedNetworkLedger;
|
||||
bool m_amendmentBlocked;
|
||||
std::atomic <bool> needNetworkLedger_ {false};
|
||||
std::atomic <bool> amendmentBlocked_ {false};
|
||||
|
||||
ClosureCounter<void, boost::system::error_code const&> waitHandlerCounter_;
|
||||
boost::asio::steady_timer heartbeatTimer_;
|
||||
@@ -597,7 +594,7 @@ private:
|
||||
DispatchState mDispatchState = DispatchState::none;
|
||||
std::vector <TransactionStatus> mTransactions;
|
||||
|
||||
StateAccounting accounting_;
|
||||
StateAccounting accounting_ {};
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@@ -1258,7 +1255,7 @@ Json::Value NetworkOPsImp::getOwnerInfo (
|
||||
|
||||
void NetworkOPsImp::setAmendmentBlocked ()
|
||||
{
|
||||
m_amendmentBlocked = true;
|
||||
amendmentBlocked_ = true;
|
||||
setMode (omTRACKING);
|
||||
}
|
||||
|
||||
@@ -1585,7 +1582,7 @@ void NetworkOPsImp::endConsensus ()
|
||||
// Count number of peers that agree with us and UNL nodes whose
|
||||
// validations we have for LCL. If the ledger is good enough, go to
|
||||
// omTRACKING - TODO
|
||||
if (!mNeedNetworkLedger)
|
||||
if (!needNetworkLedger_)
|
||||
setMode (omTRACKING);
|
||||
}
|
||||
|
||||
@@ -1852,7 +1849,7 @@ void NetworkOPsImp::setMode (OperatingMode om)
|
||||
om = omCONNECTED;
|
||||
}
|
||||
|
||||
if ((om > omTRACKING) && m_amendmentBlocked)
|
||||
if ((om > omTRACKING) && amendmentBlocked_)
|
||||
om = omTRACKING;
|
||||
|
||||
if (mMode == om)
|
||||
@@ -2151,7 +2148,7 @@ Json::Value NetworkOPsImp::getServerInfo (bool human, bool admin)
|
||||
|
||||
info [jss::server_state] = strOperatingMode ();
|
||||
|
||||
if (mNeedNetworkLedger)
|
||||
if (needNetworkLedger_)
|
||||
info[jss::network_ledger] = "waiting";
|
||||
|
||||
info[jss::validation_quorum] = static_cast<Json::UInt>(
|
||||
@@ -2181,7 +2178,7 @@ Json::Value NetworkOPsImp::getServerInfo (bool human, bool admin)
|
||||
info[jss::complete_ledgers] =
|
||||
app_.getLedgerMaster ().getCompleteLedgers ();
|
||||
|
||||
if (m_amendmentBlocked)
|
||||
if (amendmentBlocked_)
|
||||
info[jss::amendment_blocked] = true;
|
||||
|
||||
auto const fp = m_ledgerMaster.getFetchPackCacheSize ();
|
||||
|
||||
Reference in New Issue
Block a user