This commit is contained in:
JoelKatz
2012-09-01 01:01:28 -07:00
parent 3bd054748e
commit 3005d46b12

View File

@@ -1,6 +1,7 @@
#include "Suppression.h"
#include <boost/foreach.hpp>
bool SuppressionTable::addSuppression(const uint160& suppression)
{
boost::mutex::scoped_lock sl(mSuppressionMutex);
@@ -9,15 +10,16 @@ bool SuppressionTable::addSuppression(const uint160& suppression)
return false;
time_t now = time(NULL);
time_t expireTime = now - mHoldTime;
boost::unordered_map< time_t, std::list<uint160> >::iterator it = mSuppressionTimes.begin();
while (it != mSuppressionTimes.end())
boost::unordered_map< time_t, std::list<uint160> >::iterator
it = mSuppressionTimes.begin(), end = mSuppressionTimes.end();
while (it != end)
{
if ((it->first + mHoldTime) < now)
if (it->first <= expireTime)
{
for (std::list<uint160>::iterator lit = it->second.begin(), end = it->second.end();
lit != end; ++lit)
mSuppressionMap.erase(*lit);
BOOST_FOREACH(const uint160& lit, it->second)
mSuppressionMap.erase(lit);
it = mSuppressionTimes.erase(it);
}
else ++it;