Inject journals:

Calls to WriteLog are replaced with injected journals
This commit is contained in:
seelabs
2015-09-19 11:06:12 -07:00
committed by Vinnie Falco
parent df6ac8f7f5
commit 92b2ca70b7
131 changed files with 1336 additions and 1076 deletions

View File

@@ -72,7 +72,8 @@ bool PeerSet::insert (Peer::ptr const& ptr)
void PeerSet::setTimer ()
{
mTimer.expires_from_now (boost::posix_time::milliseconds (mTimerInterval));
mTimer.async_wait (std::bind (&PeerSet::timerEntry, pmDowncast (), beast::asio::placeholders::error));
mTimer.async_wait (std::bind (&PeerSet::timerEntry, pmDowncast (),
beast::asio::placeholders::error, m_journal));
}
void PeerSet::invokeOnTimer ()
@@ -85,7 +86,7 @@ void PeerSet::invokeOnTimer ()
if (!isProgress())
{
++mTimeouts;
WriteLog (lsDEBUG, InboundLedger) << "Timeout(" << mTimeouts
JLOG (m_journal.debug) << "Timeout(" << mTimeouts
<< ") pc=" << mPeers.size () << " acquiring " << mHash;
onTimer (false, sl);
}
@@ -99,7 +100,9 @@ void PeerSet::invokeOnTimer ()
setTimer ();
}
void PeerSet::timerEntry (std::weak_ptr<PeerSet> wptr, const boost::system::error_code& result)
void PeerSet::timerEntry (
std::weak_ptr<PeerSet> wptr, const boost::system::error_code& result,
beast::Journal j)
{
if (result == boost::asio::error::operation_aborted)
return;
@@ -125,7 +128,7 @@ void PeerSet::timerEntry (std::weak_ptr<PeerSet> wptr, const boost::system::erro
if (jc > 4)
{
WriteLog (lsDEBUG, InboundLedger) << "Deferring PeerSet timer due to load";
JLOG (j.debug) << "Deferring PeerSet timer due to load";
ptr->setTimer ();
}
else