mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Clean up timeout tracking and log acquire timeouts.
This commit is contained in:
@@ -61,16 +61,24 @@ void PeerSet::resetTimer()
|
|||||||
mTimer.async_wait(boost::bind(&PeerSet::TimerEntry, pmDowncast(), boost::asio::placeholders::error));
|
mTimer.async_wait(boost::bind(&PeerSet::TimerEntry, pmDowncast(), boost::asio::placeholders::error));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PeerSet::invokeOnTimer()
|
||||||
|
{
|
||||||
|
if (!mProgress)
|
||||||
|
{
|
||||||
|
++mTimeouts;
|
||||||
|
Log(lsWARNING) << "Timeout " << mTimeouts << " acquiring " << mHash.GetHex();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
mProgress = false;
|
||||||
|
onTimer();
|
||||||
|
}
|
||||||
|
|
||||||
void PeerSet::TimerEntry(boost::weak_ptr<PeerSet> wptr, const boost::system::error_code& result)
|
void PeerSet::TimerEntry(boost::weak_ptr<PeerSet> wptr, const boost::system::error_code& result)
|
||||||
{
|
{
|
||||||
if (result == boost::asio::error::operation_aborted) return;
|
if (result == boost::asio::error::operation_aborted) return;
|
||||||
boost::shared_ptr<PeerSet> ptr = wptr.lock();
|
boost::shared_ptr<PeerSet> ptr = wptr.lock();
|
||||||
if (!ptr) return;
|
if (!ptr) return;
|
||||||
if (!ptr->mProgress)
|
ptr->invokeOnTimer();
|
||||||
++ptr->mTimeouts;
|
|
||||||
else
|
|
||||||
ptr->mProgress = false;
|
|
||||||
ptr->onTimer();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LedgerAcquire::LedgerAcquire(const uint256& hash) : PeerSet(hash, LEDGER_ACQUIRE_TIMEOUT),
|
LedgerAcquire::LedgerAcquire(const uint256& hash) : PeerSet(hash, LEDGER_ACQUIRE_TIMEOUT),
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ protected:
|
|||||||
|
|
||||||
void setComplete() { mComplete = true; }
|
void setComplete() { mComplete = true; }
|
||||||
void setFailed() { mFailed = true; }
|
void setFailed() { mFailed = true; }
|
||||||
|
void invokeOnTimer();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void TimerEntry(boost::weak_ptr<PeerSet>, const boost::system::error_code& result);
|
static void TimerEntry(boost::weak_ptr<PeerSet>, const boost::system::error_code& result);
|
||||||
|
|||||||
Reference in New Issue
Block a user