diff --git a/src/ripple_app/ledger/InboundLedger.cpp b/src/ripple_app/ledger/InboundLedger.cpp index e9f7b0c5a2..562f0f9f41 100644 --- a/src/ripple_app/ledger/InboundLedger.cpp +++ b/src/ripple_app/ledger/InboundLedger.cpp @@ -162,7 +162,10 @@ void InboundLedger::onTimer (bool wasProgress, ScopedLockType&) 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 (); done (); return; @@ -236,8 +239,21 @@ void InboundLedger::addPeers () } if (!found) + { 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 InboundLedger::pmDowncast () diff --git a/src/ripple_app/peers/Peer.cpp b/src/ripple_app/peers/Peer.cpp index c4717b17fc..dec99bec54 100644 --- a/src/ripple_app/peers/Peer.cpp +++ b/src/ripple_app/peers/Peer.cpp @@ -192,6 +192,7 @@ public: return mClosedLedgerHash; } bool hasLedger (uint256 const & hash, uint32 seq) const; + void ledgerRange (uint32& minSeq, uint32& maxSeq) const; bool hasTxSet (uint256 const & hash) const; uint64 getPeerId () const { @@ -2289,6 +2290,14 @@ void PeerImp::recvLedger (const boost::shared_ptr& packe 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 { boost::mutex::scoped_lock sl(mRecentLock); @@ -2589,6 +2598,12 @@ Json::Value PeerImp::getJson () ret["protocol"] = BuildInfo::Protocol (mHello.protoversion ()).toStdString (); } + uint32 minSeq, maxSeq; + ledgerRange(minSeq, maxSeq); + if ((minSeq != 0) || (maxSeq != 0)) + ret["complete_ledgers"] = boost::lexical_cast(minSeq) + " - " + + boost::lexical_cast(maxSeq); + if (!!mClosedLedgerHash) ret["ledger"] = mClosedLedgerHash.GetHex (); diff --git a/src/ripple_app/peers/Peer.h b/src/ripple_app/peers/Peer.h index e1eace4d83..7752769923 100644 --- a/src/ripple_app/peers/Peer.h +++ b/src/ripple_app/peers/Peer.h @@ -89,6 +89,8 @@ public: 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 uint64 getPeerId () const = 0;