mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Begin using the new code.
This commit is contained in:
@@ -66,3 +66,35 @@ bool SuppressionTable::addSuppressionFlags(const uint256& index, int flag)
|
||||
findCreateEntry(index, created).setFlag(flag);
|
||||
return created;
|
||||
}
|
||||
|
||||
bool SuppressionTable::setFlag(const uint256& index, int flag)
|
||||
{ // return: true = changed, false = unchanged
|
||||
assert(flag != 0);
|
||||
|
||||
boost::mutex::scoped_lock sl(mSuppressionMutex);
|
||||
|
||||
bool created;
|
||||
Suppression &s = findCreateEntry(index, created);
|
||||
|
||||
if ((s.getFlags() & flag) == flag)
|
||||
return false;
|
||||
|
||||
s.setFlag(flag);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SuppressionTable::swapSet(const uint256& index, std::set<uint64>& peers, int flag)
|
||||
{
|
||||
boost::mutex::scoped_lock sl(mSuppressionMutex);
|
||||
|
||||
bool created;
|
||||
Suppression &s = findCreateEntry(index, created);
|
||||
|
||||
if ((s.getFlags() & flag) == flag)
|
||||
return false;
|
||||
|
||||
s.swapSet(peers);
|
||||
s.setFlag(flag);
|
||||
|
||||
return true;
|
||||
}
|
||||
Reference in New Issue
Block a user