mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-21 03:26:01 +00:00
Better logging of ledger fetching.
This commit is contained in:
@@ -162,7 +162,10 @@ void InboundLedger::onTimer (bool wasProgress, ScopedLockType&)
|
|||||||
|
|
||||||
if (getTimeouts () > LEDGER_TIMEOUT_COUNT)
|
if (getTimeouts () > LEDGER_TIMEOUT_COUNT)
|
||||||
{
|
{
|
||||||
WriteLog (lsWARNING, InboundLedger) << "Too many timeouts( " << getTimeouts () << ") for ledger " << mHash;
|
if (mSeq != 0)
|
||||||
|
WriteLog (lsWARNING, InboundLedger) << getTimeouts() << " timeouts for ledger " << mSeq;
|
||||||
|
else
|
||||||
|
WriteLog (lsWARNING, InboundLedger) << getTimeouts() << " timeouts for ledger " << mHash;
|
||||||
setFailed ();
|
setFailed ();
|
||||||
done ();
|
done ();
|
||||||
return;
|
return;
|
||||||
@@ -236,8 +239,21 @@ void InboundLedger::addPeers ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!found)
|
if (!found)
|
||||||
|
{
|
||||||
for (int i = 0; (i < 6) && (i < vSize); ++i)
|
for (int i = 0; (i < 6) && (i < vSize); ++i)
|
||||||
peerHas (peerList[ (i + firstPeer) % vSize]);
|
{
|
||||||
|
if (peerHas (peerList[ (i + firstPeer) % vSize]))
|
||||||
|
++found;
|
||||||
|
}
|
||||||
|
if (mSeq != 0)
|
||||||
|
WriteLog (lsDEBUG, InboundLedger) << "Chose " << found << " peer(s) for ledger " << mSeq;
|
||||||
|
else
|
||||||
|
WriteLog (lsDEBUG, InboundLedger) << "Chose " << found << " peer(s) for ledger " << getHash ().GetHex();
|
||||||
|
}
|
||||||
|
else if (mSeq != 0)
|
||||||
|
WriteLog (lsDEBUG, InboundLedger) << "Found " << found << " peer(s) with ledger " << mSeq;
|
||||||
|
else
|
||||||
|
WriteLog (lsDEBUG, InboundLedger) << "Found " << found << " peer(s) with ledger " << getHash ().GetHex();
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::weak_ptr<PeerSet> InboundLedger::pmDowncast ()
|
boost::weak_ptr<PeerSet> InboundLedger::pmDowncast ()
|
||||||
|
|||||||
@@ -192,6 +192,7 @@ public:
|
|||||||
return mClosedLedgerHash;
|
return mClosedLedgerHash;
|
||||||
}
|
}
|
||||||
bool hasLedger (uint256 const & hash, uint32 seq) const;
|
bool hasLedger (uint256 const & hash, uint32 seq) const;
|
||||||
|
void ledgerRange (uint32& minSeq, uint32& maxSeq) const;
|
||||||
bool hasTxSet (uint256 const & hash) const;
|
bool hasTxSet (uint256 const & hash) const;
|
||||||
uint64 getPeerId () const
|
uint64 getPeerId () const
|
||||||
{
|
{
|
||||||
@@ -2289,6 +2290,14 @@ void PeerImp::recvLedger (const boost::shared_ptr<protocol::TMLedgerData>& packe
|
|||||||
applyLoadCharge (LT_UnwantedData);
|
applyLoadCharge (LT_UnwantedData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PeerImp::ledgerRange (uint32& minSeq, uint32& maxSeq) const
|
||||||
|
{
|
||||||
|
boost::mutex::scoped_lock sl(mRecentLock);
|
||||||
|
|
||||||
|
minSeq = mMinLedger;
|
||||||
|
maxSeq = mMaxLedger;
|
||||||
|
}
|
||||||
|
|
||||||
bool PeerImp::hasLedger (uint256 const& hash, uint32 seq) const
|
bool PeerImp::hasLedger (uint256 const& hash, uint32 seq) const
|
||||||
{
|
{
|
||||||
boost::mutex::scoped_lock sl(mRecentLock);
|
boost::mutex::scoped_lock sl(mRecentLock);
|
||||||
@@ -2589,6 +2598,12 @@ Json::Value PeerImp::getJson ()
|
|||||||
ret["protocol"] = BuildInfo::Protocol (mHello.protoversion ()).toStdString ();
|
ret["protocol"] = BuildInfo::Protocol (mHello.protoversion ()).toStdString ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32 minSeq, maxSeq;
|
||||||
|
ledgerRange(minSeq, maxSeq);
|
||||||
|
if ((minSeq != 0) || (maxSeq != 0))
|
||||||
|
ret["complete_ledgers"] = boost::lexical_cast<std::string>(minSeq) + " - " +
|
||||||
|
boost::lexical_cast<std::string>(maxSeq);
|
||||||
|
|
||||||
if (!!mClosedLedgerHash)
|
if (!!mClosedLedgerHash)
|
||||||
ret["ledger"] = mClosedLedgerHash.GetHex ();
|
ret["ledger"] = mClosedLedgerHash.GetHex ();
|
||||||
|
|
||||||
|
|||||||
@@ -89,6 +89,8 @@ public:
|
|||||||
|
|
||||||
virtual bool hasLedger (uint256 const& hash, uint32 seq) const = 0;
|
virtual bool hasLedger (uint256 const& hash, uint32 seq) const = 0;
|
||||||
|
|
||||||
|
virtual void ledgerRange (uint32& minSeq, uint32& maxSeq) const = 0;
|
||||||
|
|
||||||
virtual bool hasTxSet (uint256 const& hash) const = 0;
|
virtual bool hasTxSet (uint256 const& hash) const = 0;
|
||||||
|
|
||||||
virtual uint64 getPeerId () const = 0;
|
virtual uint64 getPeerId () const = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user