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));
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
if (result == boost::asio::error::operation_aborted) return;
|
||||
boost::shared_ptr<PeerSet> ptr = wptr.lock();
|
||||
if (!ptr) return;
|
||||
if (!ptr->mProgress)
|
||||
++ptr->mTimeouts;
|
||||
else
|
||||
ptr->mProgress = false;
|
||||
ptr->onTimer();
|
||||
ptr->invokeOnTimer();
|
||||
}
|
||||
|
||||
LedgerAcquire::LedgerAcquire(const uint256& hash) : PeerSet(hash, LEDGER_ACQUIRE_TIMEOUT),
|
||||
|
||||
@@ -52,6 +52,7 @@ protected:
|
||||
|
||||
void setComplete() { mComplete = true; }
|
||||
void setFailed() { mFailed = true; }
|
||||
void invokeOnTimer();
|
||||
|
||||
private:
|
||||
static void TimerEntry(boost::weak_ptr<PeerSet>, const boost::system::error_code& result);
|
||||
|
||||
Reference in New Issue
Block a user