mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Inject journals:
Calls to WriteLog are replaced with injected journals
This commit is contained in:
@@ -119,7 +119,7 @@ bool Manifest::revoked () const
|
||||
|
||||
void
|
||||
ManifestCache::configValidatorKey(
|
||||
std::string const& line, beast::Journal const& journal)
|
||||
std::string const& line, beast::Journal journal)
|
||||
{
|
||||
auto const words = beast::rfc2616::split(line.begin(), line.end(), ' ');
|
||||
|
||||
@@ -157,7 +157,7 @@ ManifestCache::configValidatorKey(
|
||||
|
||||
void
|
||||
ManifestCache::configManifest (
|
||||
Manifest m, UniqueNodeList& unl, beast::Journal const& journal)
|
||||
Manifest m, UniqueNodeList& unl, beast::Journal journal)
|
||||
{
|
||||
if (!m.verify())
|
||||
{
|
||||
@@ -190,7 +190,7 @@ ManifestCache::addTrustedKey (PublicKey const& pk, std::string comment)
|
||||
|
||||
ManifestDisposition
|
||||
ManifestCache::canApply (PublicKey const& pk, std::uint32_t seq,
|
||||
beast::Journal const& journal) const
|
||||
beast::Journal journal) const
|
||||
{
|
||||
auto const iter = map_.find(pk);
|
||||
|
||||
@@ -227,7 +227,7 @@ ManifestCache::canApply (PublicKey const& pk, std::uint32_t seq,
|
||||
|
||||
ManifestDisposition
|
||||
ManifestCache::applyManifest (
|
||||
Manifest m, UniqueNodeList& unl, beast::Journal const& journal)
|
||||
Manifest m, UniqueNodeList& unl, beast::Journal journal)
|
||||
{
|
||||
{
|
||||
std::lock_guard<std::mutex> lock (mutex_);
|
||||
@@ -334,7 +334,7 @@ ManifestCache::applyManifest (
|
||||
}
|
||||
|
||||
void ManifestCache::load (
|
||||
DatabaseCon& dbCon, UniqueNodeList& unl, beast::Journal const& journal)
|
||||
DatabaseCon& dbCon, UniqueNodeList& unl, beast::Journal journal)
|
||||
{
|
||||
static const char* const sql =
|
||||
"SELECT RawData FROM ValidatorManifests;";
|
||||
|
||||
@@ -185,7 +185,7 @@ private:
|
||||
|
||||
ManifestDisposition
|
||||
canApply (PublicKey const& pk, std::uint32_t seq,
|
||||
beast::Journal const& journal) const;
|
||||
beast::Journal journal) const;
|
||||
|
||||
public:
|
||||
ManifestCache() = default;
|
||||
@@ -193,17 +193,17 @@ public:
|
||||
ManifestCache& operator= (ManifestCache const&) = delete;
|
||||
~ManifestCache() = default;
|
||||
|
||||
void configValidatorKey(std::string const& line, beast::Journal const& journal);
|
||||
void configManifest (Manifest m, UniqueNodeList& unl, beast::Journal const& journal);
|
||||
void configValidatorKey(std::string const& line, beast::Journal journal);
|
||||
void configManifest (Manifest m, UniqueNodeList& unl, beast::Journal journal);
|
||||
|
||||
void addTrustedKey (PublicKey const& pk, std::string comment);
|
||||
|
||||
ManifestDisposition
|
||||
applyManifest (
|
||||
Manifest m, UniqueNodeList& unl, beast::Journal const& journal);
|
||||
Manifest m, UniqueNodeList& unl, beast::Journal journal);
|
||||
|
||||
void load (
|
||||
DatabaseCon& dbCon, UniqueNodeList& unl, beast::Journal const& journal);
|
||||
DatabaseCon& dbCon, UniqueNodeList& unl, beast::Journal journal);
|
||||
void save (DatabaseCon& dbCon) const;
|
||||
|
||||
// A "for_each" for populated manifests only
|
||||
|
||||
@@ -139,11 +139,11 @@ OverlayImpl::OverlayImpl (
|
||||
, work_ (boost::in_place(std::ref(io_service_)))
|
||||
, strand_ (io_service_)
|
||||
, setup_(setup)
|
||||
, journal_ (app_.logs().journal("Overlay"))
|
||||
, journal_ (app_.journal("Overlay"))
|
||||
, serverHandler_(serverHandler)
|
||||
, m_resourceManager (resourceManager)
|
||||
, m_peerFinder (PeerFinder::make_Manager (*this, io_service,
|
||||
stopwatch(), app_.logs().journal("PeerFinder"), config))
|
||||
stopwatch(), app_.journal("PeerFinder"), config))
|
||||
, m_resolver (resolver)
|
||||
, next_id_(1)
|
||||
, timer_count_(0)
|
||||
@@ -356,7 +356,7 @@ OverlayImpl::connect (beast::IP::Endpoint const& remote_endpoint)
|
||||
auto const p = std::make_shared<ConnectAttempt>(app_,
|
||||
io_service_, beast::IPAddressConversion::to_asio_endpoint(remote_endpoint),
|
||||
usage, setup_.context, next_id_++, slot,
|
||||
app_.logs().journal("Peer"), *this);
|
||||
app_.journal("Peer"), *this);
|
||||
|
||||
std::lock_guard<decltype(mutex_)> lock(mutex_);
|
||||
list_.emplace(p.get(), p);
|
||||
|
||||
@@ -59,8 +59,8 @@ PeerImp::PeerImp (Application& app, id_t id, endpoint_type remote_endpoint,
|
||||
: Child (overlay)
|
||||
, app_ (app)
|
||||
, id_(id)
|
||||
, sink_(app_.logs().journal("Peer"), makePrefix(id))
|
||||
, p_sink_(app_.logs().journal("Protocol"), makePrefix(id))
|
||||
, sink_(app_.journal("Peer"), makePrefix(id))
|
||||
, p_sink_(app_.journal("Protocol"), makePrefix(id))
|
||||
, journal_ (sink_)
|
||||
, p_journal_(p_sink_)
|
||||
, ssl_bundle_(std::move(ssl_bundle))
|
||||
|
||||
@@ -489,8 +489,8 @@ PeerImp::PeerImp (Application& app, std::unique_ptr<beast::asio::ssl_bundle>&& s
|
||||
: Child (overlay)
|
||||
, app_ (app)
|
||||
, id_ (id)
|
||||
, sink_ (app_.logs().journal("Peer"), makePrefix(id))
|
||||
, p_sink_ (app_.logs().journal("Protocol"), makePrefix(id))
|
||||
, sink_ (app_.journal("Peer"), makePrefix(id))
|
||||
, p_sink_ (app_.journal("Protocol"), makePrefix(id))
|
||||
, journal_ (sink_)
|
||||
, p_journal_ (p_sink_)
|
||||
, ssl_bundle_(std::move(ssl_bundle))
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user