mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Inject Application:
Calls to getApp are replaced with dependency injections.
This commit is contained in:
committed by
Edward Hennis
parent
f4fe55caff
commit
9b787434c9
@@ -35,9 +35,10 @@ class InboundLedger;
|
||||
// derived class. Why not just make the timer callback
|
||||
// function pure virtual?
|
||||
//
|
||||
PeerSet::PeerSet (uint256 const& hash, int interval, bool txnData,
|
||||
PeerSet::PeerSet (Application& app, uint256 const& hash, int interval, bool txnData,
|
||||
clock_type& clock, beast::Journal journal)
|
||||
: m_journal (journal)
|
||||
: app_ (app)
|
||||
, m_journal (journal)
|
||||
, m_clock (clock)
|
||||
, mHash (hash)
|
||||
, mTimerInterval (interval)
|
||||
@@ -47,7 +48,7 @@ PeerSet::PeerSet (uint256 const& hash, int interval, bool txnData,
|
||||
, mAggressive (false)
|
||||
, mTxnData (txnData)
|
||||
, mProgress (false)
|
||||
, mTimer (getApp().getIOService ())
|
||||
, mTimer (app_.getIOService ())
|
||||
{
|
||||
mLastAction = m_clock.now();
|
||||
assert ((mTimerInterval > 10) && (mTimerInterval < 30000));
|
||||
@@ -113,14 +114,14 @@ void PeerSet::timerEntry (std::weak_ptr<PeerSet> wptr, const boost::system::erro
|
||||
//
|
||||
if (ptr->mTxnData)
|
||||
{
|
||||
getApp().getJobQueue ().addJob (
|
||||
ptr->app_.getJobQueue ().addJob (
|
||||
jtTXN_DATA, "timerEntryTxn", [ptr] (Job&) {
|
||||
timerJobEntry(ptr);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
int jc = getApp().getJobQueue ().getJobCountTotal (jtLEDGER_DATA);
|
||||
int jc = ptr->app_.getJobQueue ().getJobCountTotal (jtLEDGER_DATA);
|
||||
|
||||
if (jc > 4)
|
||||
{
|
||||
@@ -128,7 +129,7 @@ void PeerSet::timerEntry (std::weak_ptr<PeerSet> wptr, const boost::system::erro
|
||||
ptr->setTimer ();
|
||||
}
|
||||
else
|
||||
getApp().getJobQueue ().addJob (
|
||||
ptr->app_.getJobQueue ().addJob (
|
||||
jtLEDGER_DATA, "timerEntryLgr", [ptr] (Job&) {
|
||||
timerJobEntry(ptr);
|
||||
});
|
||||
@@ -167,7 +168,7 @@ void PeerSet::sendRequest (const protocol::TMGetLedger& tmGL)
|
||||
|
||||
for (auto const& p : mPeers)
|
||||
{
|
||||
Peer::ptr peer (getApp().overlay ().findPeerByShortID (p.first));
|
||||
Peer::ptr peer (app_.overlay ().findPeerByShortID (p.first));
|
||||
|
||||
if (peer)
|
||||
peer->send (packet);
|
||||
@@ -180,7 +181,7 @@ std::size_t PeerSet::getPeerCount () const
|
||||
|
||||
for (auto const& p : mPeers)
|
||||
{
|
||||
if (getApp ().overlay ().findPeerByShortID (p.first))
|
||||
if (app_.overlay ().findPeerByShortID (p.first))
|
||||
++ret;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user