From 96eac78174f31e172083193cfa0c00661615ecce Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Tue, 8 Jan 2013 01:47:09 -0800 Subject: [PATCH] To be a recent failure, a failure must be recent. --- src/cpp/ripple/LedgerAcquire.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/cpp/ripple/LedgerAcquire.cpp b/src/cpp/ripple/LedgerAcquire.cpp index ddee47a4c..462ab33ba 100644 --- a/src/cpp/ripple/LedgerAcquire.cpp +++ b/src/cpp/ripple/LedgerAcquire.cpp @@ -731,8 +731,25 @@ void LedgerAcquireMaster::logFailure(const uint256& hash) bool LedgerAcquireMaster::isFailure(const uint256& hash) { + time_t now = time(NULL); boost::mutex::scoped_lock sl(mLock); - return mRecentFailures.find(hash) != mRecentFailures.end(); + + std::map::iterator it = mRecentFailures.find(hash); + if (it == mRecentFailures.end()) + return false; + + if (it->second > now) + { + it->second = now; + return true; + } + + if ((it->second + 180) < now) + { + mRecentFailures.erase(it); + return false; + } + return true; } void LedgerAcquireMaster::sweep()