Access Journal::Stream using member functions (RIPD-1087):

Replace Journal public data members with member function accessors
in order to make Journal lighter weight.  The change makes a
Journal cheaper to pass by value.

Also add missing stream checks (e.g., calls to JLOG) to avoid
text processing that ultimately will not be stored in the log.
This commit is contained in:
Scott Schurr
2016-03-09 10:48:21 -08:00
committed by seelabs
parent b3f5986c83
commit 7a4bd2278d
132 changed files with 1843 additions and 1799 deletions

View File

@@ -97,7 +97,7 @@ PeerImp::~PeerImp ()
{
if (cluster())
{
JLOG(journal_.warning) << name_ << " left cluster";
JLOG(journal_.warn()) << name_ << " left cluster";
}
if (state_ == State::active)
overlay_.onPeerDeactivate(id_);
@@ -172,11 +172,11 @@ PeerImp::stop()
//
if(m_inbound)
{
JLOG(journal_.debug) << "Stop";
JLOG(journal_.debug()) << "Stop";
}
else
{
JLOG(journal_.info) << "Stop";
JLOG(journal_.info()) << "Stop";
}
}
close();
@@ -350,7 +350,7 @@ PeerImp::json()
default:
// FIXME: do we really want this?
JLOG(p_journal_.warning) <<
JLOG(p_journal_.warn()) <<
"Unknown status: " << last_status_.newstatus ();
}
}
@@ -422,11 +422,11 @@ PeerImp::close()
socket_.close(ec);
if(m_inbound)
{
JLOG(journal_.debug) << "Closed";
JLOG(journal_.debug()) << "Closed";
}
else
{
JLOG(journal_.info) << "Closed";
JLOG(journal_.info()) << "Closed";
}
}
}
@@ -440,7 +440,7 @@ PeerImp::fail(std::string const& reason)
shared_from_this(), reason));
if (socket_.is_open())
{
JLOG (journal_.debug) << reason;
JLOG (journal_.debug()) << reason;
}
close();
}
@@ -451,7 +451,7 @@ PeerImp::fail(std::string const& name, error_code ec)
assert(strand_.running_in_this_thread());
if (socket_.is_open())
{
JLOG(journal_.debug) << name << ": " << ec.message();
JLOG(journal_.debug()) << name << ": " << ec.message();
}
close();
}
@@ -484,7 +484,7 @@ PeerImp::setTimer()
if (ec)
{
JLOG(journal_.error) << "setTimer: " << ec.message();
JLOG(journal_.error()) << "setTimer: " << ec.message();
return;
}
timer_.async_wait(strand_.wrap(std::bind(&PeerImp::onTimer,
@@ -521,7 +521,7 @@ PeerImp::onTimer (error_code const& ec)
if (ec)
{
// This should never happen
JLOG(journal_.error) << "onTimer: " << ec.message();
JLOG(journal_.error()) << "onTimer: " << ec.message();
return close();
}
@@ -573,7 +573,7 @@ PeerImp::onShutdown(error_code ec)
// If we don't get eof then something went wrong
if (! ec)
{
JLOG(journal_.error) << "onShutdown: expected error condition";
JLOG(journal_.error()) << "onShutdown: expected error condition";
return close();
}
if (ec != boost::asio::error::eof)
@@ -588,7 +588,7 @@ void PeerImp::doAccept()
assert(read_buffer_.size() == 0);
assert(http_message_.upgrade());
JLOG(journal_.debug) << "doAccept: " << remote_address_;
JLOG(journal_.debug()) << "doAccept: " << remote_address_;
auto sharedValue = makeSharedValue(
ssl_bundle_->stream.native_handle(), journal_);
@@ -605,15 +605,15 @@ void PeerImp::doAccept()
beast::http::write (write_buffer_, resp);
auto const protocol = BuildInfo::make_protocol(hello_.protoversion());
JLOG(journal_.info) << "Protocol: " << to_string(protocol);
JLOG(journal_.info) <<
JLOG(journal_.info()) << "Protocol: " << to_string(protocol);
JLOG(journal_.info()) <<
"Public Key: " << toBase58 (
TokenType::TOKEN_NODE_PUBLIC,
publicKey_);
if (auto member = app_.cluster().member(publicKey_))
{
name_ = *member;
JLOG(journal_.info) << "Cluster name: " << name_;
JLOG(journal_.info()) << "Cluster name: " << name_;
}
overlay_.activate(shared_from_this());
@@ -673,13 +673,13 @@ PeerImp::onWriteResponse (error_code ec, std::size_t bytes_transferred)
return;
if(ec)
return fail("onWriteResponse", ec);
if(journal_.trace)
if(auto stream = journal_.trace())
{
if (bytes_transferred > 0)
journal_.trace <<
stream <<
"onWriteResponse: " << bytes_transferred << " bytes";
else
journal_.trace << "onWriteResponse";
stream << "onWriteResponse";
}
write_buffer_.consume (bytes_transferred);
@@ -730,18 +730,18 @@ PeerImp::onReadMessage (error_code ec, std::size_t bytes_transferred)
return;
if(ec == boost::asio::error::eof)
{
JLOG(journal_.info) << "EOF";
JLOG(journal_.info()) << "EOF";
return gracefulClose();
}
if(ec)
return fail("onReadMessage", ec);
if(journal_.trace)
if(auto stream = journal_.trace())
{
if (bytes_transferred > 0)
journal_.trace <<
stream <<
"onReadMessage: " << bytes_transferred << " bytes";
else
journal_.trace << "onReadMessage";
stream << "onReadMessage";
}
read_buffer_.commit (bytes_transferred);
@@ -777,13 +777,13 @@ PeerImp::onWriteMessage (error_code ec, std::size_t bytes_transferred)
return;
if(ec)
return fail("onWriteMessage", ec);
if(journal_.trace)
if(auto stream = journal_.trace())
{
if (bytes_transferred > 0)
journal_.trace <<
stream <<
"onWriteMessage: " << bytes_transferred << " bytes";
else
journal_.trace << "onWriteMessage";
stream << "onWriteMessage";
}
assert(! send_queue_.empty());
@@ -1090,7 +1090,7 @@ PeerImp::onMessage (std::shared_ptr <protocol::TMTransaction> const& m)
return;
}
JLOG(p_journal_.debug) << "Got tx " << txID;
JLOG(p_journal_.debug()) << "Got tx " << txID;
bool checkSignature = true;
if (cluster())
@@ -1112,11 +1112,11 @@ PeerImp::onMessage (std::shared_ptr <protocol::TMTransaction> const& m)
if (app_.getJobQueue().getJobCount(jtTRANSACTION) > 100)
{
JLOG(p_journal_.info) << "Transaction queue is full";
JLOG(p_journal_.info()) << "Transaction queue is full";
}
else if (app_.getLedgerMaster().getValidatedLedgerAge() > 4min)
{
JLOG(p_journal_.trace) << "No new transactions until synchronized";
JLOG(p_journal_.trace()) << "No new transactions until synchronized";
}
else
{
@@ -1132,7 +1132,7 @@ PeerImp::onMessage (std::shared_ptr <protocol::TMTransaction> const& m)
}
catch (std::exception const&)
{
JLOG(p_journal_.warning) << "Transaction invalid: " <<
JLOG(p_journal_.warn()) << "Transaction invalid: " <<
strHex(m->rawtransaction ());
}
}
@@ -1157,7 +1157,7 @@ PeerImp::onMessage (std::shared_ptr <protocol::TMLedgerData> const& m)
if (m->nodes ().size () <= 0)
{
JLOG(p_journal_.warning) << "Ledger/TXset data with no nodes";
JLOG(p_journal_.warn()) << "Ledger/TXset data with no nodes";
return;
}
@@ -1172,7 +1172,7 @@ PeerImp::onMessage (std::shared_ptr <protocol::TMLedgerData> const& m)
}
else
{
JLOG(p_journal_.info) << "Unable to route TX/ledger data reply";
JLOG(p_journal_.info()) << "Unable to route TX/ledger data reply";
fee_ = Resource::feeUnwantedData;
}
return;
@@ -1182,7 +1182,7 @@ PeerImp::onMessage (std::shared_ptr <protocol::TMLedgerData> const& m)
if (m->ledgerhash ().size () != 32)
{
JLOG(p_journal_.warning) << "TX candidate reply with invalid hash size";
JLOG(p_journal_.warn()) << "TX candidate reply with invalid hash size";
fee_ = Resource::feeInvalidRequest;
return;
}
@@ -1206,7 +1206,7 @@ PeerImp::onMessage (std::shared_ptr <protocol::TMLedgerData> const& m)
if (!app_.getInboundLedgers ().gotLedgerData (
hash, shared_from_this(), m))
{
JLOG(p_journal_.trace) << "Got data for unwanted ledger";
JLOG(p_journal_.trace()) << "Got data for unwanted ledger";
fee_ = Resource::feeUnwantedData;
}
}
@@ -1234,14 +1234,14 @@ PeerImp::onMessage (std::shared_ptr <protocol::TMProposeSet> const& m)
(set.signature ().size () > 128)
)
{
JLOG(p_journal_.warning) << "Proposal: malformed";
JLOG(p_journal_.warn()) << "Proposal: malformed";
fee_ = Resource::feeInvalidSignature;
return;
}
if (set.previousledger ().size () != 32)
{
JLOG(p_journal_.warning) << "Proposal: malformed";
JLOG(p_journal_.warn()) << "Proposal: malformed";
fee_ = Resource::feeInvalidRequest;
return;
}
@@ -1260,14 +1260,14 @@ PeerImp::onMessage (std::shared_ptr <protocol::TMProposeSet> const& m)
if (! app_.getHashRouter ().addSuppressionPeer (suppression, id_))
{
JLOG(p_journal_.trace) << "Proposal: duplicate";
JLOG(p_journal_.trace()) << "Proposal: duplicate";
return;
}
if (app_.config().VALIDATION_PUB.size() &&
publicKey == app_.config().VALIDATION_PUB)
{
JLOG(p_journal_.trace) << "Proposal: self";
JLOG(p_journal_.trace()) << "Proposal: self";
return;
}
@@ -1277,18 +1277,18 @@ PeerImp::onMessage (std::shared_ptr <protocol::TMProposeSet> const& m)
{
if (sanity_.load() == Sanity::insane)
{
JLOG(p_journal_.debug) << "Proposal: Dropping UNTRUSTED (insane)";
JLOG(p_journal_.debug()) << "Proposal: Dropping UNTRUSTED (insane)";
return;
}
if (app_.getFeeTrack ().isLoadedLocal ())
{
JLOG(p_journal_.debug) << "Proposal: Dropping UNTRUSTED (load)";
JLOG(p_journal_.debug()) << "Proposal: Dropping UNTRUSTED (load)";
return;
}
}
JLOG(p_journal_.trace) <<
JLOG(p_journal_.trace()) <<
"Proposal: " << (isTrusted ? "trusted" : "UNTRUSTED");
auto proposal = std::make_shared<LedgerProposal> (
@@ -1308,7 +1308,7 @@ PeerImp::onMessage (std::shared_ptr <protocol::TMProposeSet> const& m)
void
PeerImp::onMessage (std::shared_ptr <protocol::TMStatusChange> const& m)
{
JLOG(p_journal_.trace) << "Status: Change";
JLOG(p_journal_.trace()) << "Status: Change";
if (!m->has_networktime ())
m->set_networktime (app_.timeKeeper().now().time_since_epoch().count());
@@ -1327,7 +1327,7 @@ PeerImp::onMessage (std::shared_ptr <protocol::TMStatusChange> const& m)
{
if (!closedLedgerHash_.isZero ())
{
JLOG(p_journal_.trace) << "Status: Out of sync";
JLOG(p_journal_.trace()) << "Status: Out of sync";
closedLedgerHash_.zero ();
}
@@ -1340,11 +1340,11 @@ PeerImp::onMessage (std::shared_ptr <protocol::TMStatusChange> const& m)
// a peer has changed ledgers
memcpy (closedLedgerHash_.begin (), m->ledgerhash ().data (), 256 / 8);
addLedger (closedLedgerHash_);
JLOG(p_journal_.trace) << "LCL is " << closedLedgerHash_;
JLOG(p_journal_.trace()) << "LCL is " << closedLedgerHash_;
}
else
{
JLOG(p_journal_.trace) << "Status: No ledger";
JLOG(p_journal_.trace()) << "Status: No ledger";
closedLedgerHash_.zero ();
}
@@ -1569,7 +1569,7 @@ PeerImp::onMessage (std::shared_ptr <protocol::TMValidation> const& m)
if (m->validation ().size () < 50)
{
JLOG(p_journal_.warning) << "Validation: Too small";
JLOG(p_journal_.warn()) << "Validation: Too small";
fee_ = Resource::feeInvalidRequest;
return;
}
@@ -1586,7 +1586,7 @@ PeerImp::onMessage (std::shared_ptr <protocol::TMValidation> const& m)
if (! app_.getValidations().current (val))
{
JLOG(p_journal_.trace) << "Validation: Not current";
JLOG(p_journal_.trace()) << "Validation: Not current";
fee_ = Resource::feeUnwantedData;
return;
}
@@ -1594,7 +1594,7 @@ PeerImp::onMessage (std::shared_ptr <protocol::TMValidation> const& m)
if (! app_.getHashRouter ().addSuppressionPeer(
sha512Half(makeSlice(m->validation())), id_))
{
JLOG(p_journal_.trace) << "Validation: duplicate";
JLOG(p_journal_.trace()) << "Validation: duplicate";
return;
}
@@ -1603,7 +1603,7 @@ PeerImp::onMessage (std::shared_ptr <protocol::TMValidation> const& m)
if (!isTrusted && (sanity_.load () == Sanity::insane))
{
JLOG(p_journal_.debug) <<
JLOG(p_journal_.debug()) <<
"Validation: dropping untrusted from insane peer";
}
if (isTrusted || !app_.getFeeTrack ().isLoadedLocal ())
@@ -1623,13 +1623,13 @@ PeerImp::onMessage (std::shared_ptr <protocol::TMValidation> const& m)
}
else
{
JLOG(p_journal_.debug) <<
JLOG(p_journal_.debug()) <<
"Validation: Dropping UNTRUSTED (load)";
}
}
catch (std::exception const& e)
{
JLOG(p_journal_.warning) <<
JLOG(p_journal_.warn()) <<
"Validation: Exception, " << e.what();
fee_ = Resource::feeInvalidRequest;
}
@@ -1645,7 +1645,7 @@ PeerImp::onMessage (std::shared_ptr <protocol::TMGetObjectByHash> const& m)
// this is a query
if (send_queue_.size() >= Tuning::dropSendQueue)
{
JLOG(p_journal_.debug) << "GetObject: Large send queue";
JLOG(p_journal_.debug()) << "GetObject: Large send queue";
return;
}
@@ -1699,7 +1699,7 @@ PeerImp::onMessage (std::shared_ptr <protocol::TMGetObjectByHash> const& m)
}
}
JLOG(p_journal_.trace) <<
JLOG(p_journal_.trace()) <<
"GetObj: " << reply.objects_size () <<
" of " << packet.objects_size ();
send (std::make_shared<Message> (reply, protocol::mtGET_OBJECTS));
@@ -1723,7 +1723,7 @@ PeerImp::onMessage (std::shared_ptr <protocol::TMGetObjectByHash> const& m)
{
if (pLDo && (pLSeq != 0))
{
JLOG(p_journal_.debug) <<
JLOG(p_journal_.debug()) <<
"GetObj: Full fetch pack for " << pLSeq;
}
pLSeq = obj.ledgerseq ();
@@ -1731,7 +1731,7 @@ PeerImp::onMessage (std::shared_ptr <protocol::TMGetObjectByHash> const& m)
if (!pLDo)
{
JLOG(p_journal_.debug) <<
JLOG(p_journal_.debug()) <<
"GetObj: Late fetch pack for " << pLSeq;
}
else
@@ -1755,7 +1755,7 @@ PeerImp::onMessage (std::shared_ptr <protocol::TMGetObjectByHash> const& m)
if (pLDo && (pLSeq != 0))
{
JLOG(p_journal_.debug) <<
JLOG(p_journal_.debug()) <<
"GetObj: Partial fetch pack for " << pLSeq;
}
if (packet.type () == protocol::TMGetObjectByHash::otFETCH_PACK)
@@ -1806,13 +1806,13 @@ PeerImp::doFetchPack (const std::shared_ptr<protocol::TMGetObjectByHash>& packet
(app_.getLedgerMaster().getValidatedLedgerAge() > 40s) ||
(app_.getJobQueue().getJobCount(jtPACK) > 10))
{
JLOG(p_journal_.info) << "Too busy to make fetch pack";
JLOG(p_journal_.info()) << "Too busy to make fetch pack";
return;
}
if (packet->ledgerhash ().size () != 32)
{
JLOG(p_journal_.warning) << "FetchPack hash size malformed";
JLOG(p_journal_.warn()) << "FetchPack hash size malformed";
fee_ = Resource::feeInvalidRequest;
return;
}
@@ -1860,7 +1860,7 @@ PeerImp::checkTransaction (int flags,
{
if (!valid.second.empty())
{
JLOG(p_journal_.trace) <<
JLOG(p_journal_.trace()) <<
"Exception checking transaction: " <<
valid.second;
}
@@ -1885,7 +1885,7 @@ PeerImp::checkTransaction (int flags,
{
if (! reason.empty ())
{
JLOG(p_journal_.trace) <<
JLOG(p_journal_.trace()) <<
"Exception checking transaction: " << reason;
}
app_.getHashRouter ().setFlags (stx->getTransactionID (), SF_BAD);
@@ -1912,7 +1912,7 @@ PeerImp::checkPropose (Job& job,
{
bool isTrusted = (job.getType () == jtPROPOSAL_t);
JLOG(p_journal_.trace) <<
JLOG(p_journal_.trace()) <<
"Checking " << (isTrusted ? "trusted" : "UNTRUSTED") << " proposal";
assert (packet);
@@ -1920,7 +1920,7 @@ PeerImp::checkPropose (Job& job,
if (! cluster() && ! proposal->checkSign ())
{
JLOG(p_journal_.warning) <<
JLOG(p_journal_.warn()) <<
"Proposal fails sig check";
charge (Resource::feeInvalidSignature);
return;
@@ -1936,13 +1936,13 @@ PeerImp::checkPropose (Job& job,
if (app_.getOPs().getConsensusLCL() == proposal->getPrevLedger())
{
// relay untrusted proposal
JLOG(p_journal_.trace) <<
JLOG(p_journal_.trace()) <<
"relaying UNTRUSTED proposal";
overlay_.relay(set, proposal->getSuppressionID());
}
else
{
JLOG(p_journal_.debug) <<
JLOG(p_journal_.debug()) <<
"Not relaying UNTRUSTED proposal";
}
}
@@ -1958,7 +1958,7 @@ PeerImp::checkValidation (STValidation::pointer val,
uint256 signingHash = val->getSigningHash();
if (! cluster() && !val->isValid (signingHash))
{
JLOG(p_journal_.warning) <<
JLOG(p_journal_.warn()) <<
"Validation is invalid";
charge (Resource::feeInvalidRequest);
return;
@@ -1970,7 +1970,7 @@ PeerImp::checkValidation (STValidation::pointer val,
}
catch (std::exception const&)
{
JLOG(p_journal_.trace) <<
JLOG(p_journal_.trace()) <<
"Exception processing validation";
charge (Resource::feeInvalidRequest);
}
@@ -2050,12 +2050,12 @@ PeerImp::getLedger (std::shared_ptr<protocol::TMGetLedger> const& m)
if (packet.itype () == protocol::liTS_CANDIDATE)
{
// Request is for a transaction candidate set
JLOG(p_journal_.trace) << "GetLedger: Tx candidate set";
JLOG(p_journal_.trace()) << "GetLedger: Tx candidate set";
if ((!packet.has_ledgerhash () || packet.ledgerhash ().size () != 32))
{
charge (Resource::feeInvalidRequest);
JLOG(p_journal_.warning) << "GetLedger: Tx candidate set invalid";
JLOG(p_journal_.warn()) << "GetLedger: Tx candidate set invalid";
return;
}
@@ -2069,13 +2069,13 @@ PeerImp::getLedger (std::shared_ptr<protocol::TMGetLedger> const& m)
{
if (packet.has_querytype () && !packet.has_requestcookie ())
{
JLOG(p_journal_.debug) << "GetLedger: Routing Tx set request";
JLOG(p_journal_.debug()) << "GetLedger: Routing Tx set request";
auto const v = getPeerWithTree(
overlay_, txHash, this);
if (! v)
{
JLOG(p_journal_.info) << "GetLedger: Route TX set failed";
JLOG(p_journal_.info()) << "GetLedger: Route TX set failed";
return;
}
@@ -2085,7 +2085,7 @@ PeerImp::getLedger (std::shared_ptr<protocol::TMGetLedger> const& m)
return;
}
JLOG(p_journal_.debug) << "GetLedger: Can't provide map ";
JLOG(p_journal_.debug()) << "GetLedger: Can't provide map ";
charge (Resource::feeInvalidRequest);
return;
}
@@ -2099,18 +2099,18 @@ PeerImp::getLedger (std::shared_ptr<protocol::TMGetLedger> const& m)
{
if (send_queue_.size() >= Tuning::dropSendQueue)
{
JLOG(p_journal_.debug) << "GetLedger: Large send queue";
JLOG(p_journal_.debug()) << "GetLedger: Large send queue";
return;
}
if (app_.getFeeTrack().isLoadedLocal() && ! cluster())
{
JLOG(p_journal_.debug) << "GetLedger: Too busy";
JLOG(p_journal_.debug()) << "GetLedger: Too busy";
return;
}
// Figure out what ledger they want
JLOG(p_journal_.trace) << "GetLedger: Received";
JLOG(p_journal_.trace()) << "GetLedger: Received";
std::shared_ptr<Ledger const> ledger;
if (packet.has_ledgerhash ())
@@ -2120,7 +2120,7 @@ PeerImp::getLedger (std::shared_ptr<protocol::TMGetLedger> const& m)
if (packet.ledgerhash ().size () != 32)
{
charge (Resource::feeInvalidRequest);
JLOG(p_journal_.warning) << "GetLedger: Invalid request";
JLOG(p_journal_.warn()) << "GetLedger: Invalid request";
return;
}
@@ -2131,7 +2131,7 @@ PeerImp::getLedger (std::shared_ptr<protocol::TMGetLedger> const& m)
if (!ledger)
{
JLOG(p_journal_.trace) <<
JLOG(p_journal_.trace()) <<
"GetLedger: Don't have " << ledgerhash;
}
if (!ledger && (packet.has_querytype () &&
@@ -2146,14 +2146,14 @@ PeerImp::getLedger (std::shared_ptr<protocol::TMGetLedger> const& m)
overlay_, ledgerhash, seq, this);
if (! v)
{
JLOG(p_journal_.trace) << "GetLedger: Cannot route";
JLOG(p_journal_.trace()) << "GetLedger: Cannot route";
return;
}
packet.set_requestcookie (id ());
v->send (std::make_shared<Message>(
packet, protocol::mtGET_LEDGER));
JLOG(p_journal_.debug) << "GetLedger: Request routed";
JLOG(p_journal_.debug()) << "GetLedger: Request routed";
return;
}
}
@@ -2162,14 +2162,14 @@ PeerImp::getLedger (std::shared_ptr<protocol::TMGetLedger> const& m)
if (packet.ledgerseq() <
app_.getLedgerMaster().getEarliestFetch())
{
JLOG(p_journal_.debug) << "GetLedger: Early ledger request";
JLOG(p_journal_.debug()) << "GetLedger: Early ledger request";
return;
}
ledger = app_.getLedgerMaster ().getLedgerBySeq (
packet.ledgerseq ());
if (! ledger)
{
JLOG(p_journal_.debug) <<
JLOG(p_journal_.debug()) <<
"GetLedger: Don't have " << packet.ledgerseq ();
}
}
@@ -2188,7 +2188,7 @@ PeerImp::getLedger (std::shared_ptr<protocol::TMGetLedger> const& m)
else
{
charge (Resource::feeInvalidRequest);
JLOG(p_journal_.warning) << "GetLedger: Unknown request";
JLOG(p_journal_.warn()) << "GetLedger: Unknown request";
return;
}
@@ -2199,7 +2199,7 @@ PeerImp::getLedger (std::shared_ptr<protocol::TMGetLedger> const& m)
if (ledger)
{
JLOG(p_journal_.warning) << "GetLedger: Invalid sequence";
JLOG(p_journal_.warn()) << "GetLedger: Invalid sequence";
}
return;
}
@@ -2207,7 +2207,7 @@ PeerImp::getLedger (std::shared_ptr<protocol::TMGetLedger> const& m)
if (!packet.has_ledgerseq() && (ledger->info().seq <
app_.getLedgerMaster().getEarliestFetch()))
{
JLOG(p_journal_.debug) << "GetLedger: Early ledger request";
JLOG(p_journal_.debug()) << "GetLedger: Early ledger request";
return;
}
@@ -2220,7 +2220,7 @@ PeerImp::getLedger (std::shared_ptr<protocol::TMGetLedger> const& m)
if (packet.itype () == protocol::liBASE)
{
// they want the ledger base data
JLOG(p_journal_.trace) << "GetLedger: Base data";
JLOG(p_journal_.trace()) << "GetLedger: Base data";
Serializer nData (128);
addRaw(ledger->info(), nData);
reply.add_nodes ()->set_nodedata (
@@ -2275,13 +2275,13 @@ PeerImp::getLedger (std::shared_ptr<protocol::TMGetLedger> const& m)
if (!map || (packet.nodeids_size () == 0))
{
JLOG(p_journal_.warning) <<
JLOG(p_journal_.warn()) <<
"GetLedger: Can't find map or empty request";
charge (Resource::feeInvalidRequest);
return;
}
JLOG(p_journal_.trace) << "GetLedger: " << logMe;
JLOG(p_journal_.trace()) << "GetLedger: " << logMe;
auto const depth =
packet.has_querydepth() ?
@@ -2296,7 +2296,7 @@ PeerImp::getLedger (std::shared_ptr<protocol::TMGetLedger> const& m)
if (!mn.isValid ())
{
JLOG(p_journal_.warning) << "GetLedger: Invalid node " << logMe;
JLOG(p_journal_.warn()) << "GetLedger: Invalid node " << logMe;
charge (Resource::feeInvalidRequest);
return;
}
@@ -2311,7 +2311,7 @@ PeerImp::getLedger (std::shared_ptr<protocol::TMGetLedger> const& m)
if (map && map->getNodeFat (mn, nodeIDs, rawNodes, fatLeaves, depth))
{
assert (nodeIDs.size () == rawNodes.size ());
JLOG(p_journal_.trace) <<
JLOG(p_journal_.trace()) <<
"GetLedger: getNodeFat got " << rawNodes.size () << " nodes";
std::vector<SHAMapNodeID>::iterator nodeIDIterator;
std::vector< Blob >::iterator rawNodeIterator;
@@ -2330,7 +2330,7 @@ PeerImp::getLedger (std::shared_ptr<protocol::TMGetLedger> const& m)
}
}
else
JLOG(p_journal_.warning) <<
JLOG(p_journal_.warn()) <<
"GetLedger: getNodeFat returns false";
}
catch (std::exception&)
@@ -2349,12 +2349,12 @@ PeerImp::getLedger (std::shared_ptr<protocol::TMGetLedger> const& m)
if (!packet.has_ledgerhash ())
info += ", no hash specified";
JLOG(p_journal_.warning) <<
JLOG(p_journal_.warn()) <<
"getNodeFat( " << mn << ") throws exception: " << info;
}
}
JLOG(p_journal_.info) <<
JLOG(p_journal_.info()) <<
"Got request for " << packet.nodeids().size() << " nodes at depth " <<
depth << ", return " << reply.nodes().size() << " nodes";