mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Cleanups.
This commit is contained in:
@@ -85,8 +85,8 @@ ValidationSet ValidationCollection::getValidations(const uint256& ledger)
|
|||||||
{
|
{
|
||||||
boost::mutex::scoped_lock sl(mValidationLock);
|
boost::mutex::scoped_lock sl(mValidationLock);
|
||||||
VSpointer set = findSet(ledger);
|
VSpointer set = findSet(ledger);
|
||||||
if (set != VSpointer())
|
if (set)
|
||||||
return *set;
|
return ValidationSet(*set);
|
||||||
}
|
}
|
||||||
return ValidationSet();
|
return ValidationSet();
|
||||||
}
|
}
|
||||||
@@ -96,9 +96,9 @@ void ValidationCollection::getValidationCount(const uint256& ledger, bool curren
|
|||||||
trusted = untrusted = 0;
|
trusted = untrusted = 0;
|
||||||
boost::mutex::scoped_lock sl(mValidationLock);
|
boost::mutex::scoped_lock sl(mValidationLock);
|
||||||
VSpointer set = findSet(ledger);
|
VSpointer set = findSet(ledger);
|
||||||
uint32 now = theApp->getOPs().getNetworkTimeNC();
|
|
||||||
if (set)
|
if (set)
|
||||||
{
|
{
|
||||||
|
uint32 now = theApp->getOPs().getNetworkTimeNC();
|
||||||
BOOST_FOREACH(u160_val_pair& it, *set)
|
BOOST_FOREACH(u160_val_pair& it, *set)
|
||||||
{
|
{
|
||||||
bool isTrusted = it.second->isTrusted();
|
bool isTrusted = it.second->isTrusted();
|
||||||
@@ -260,26 +260,26 @@ ValidationCollection::getCurrentValidations(uint256 currentLedger)
|
|||||||
|
|
||||||
void ValidationCollection::flush()
|
void ValidationCollection::flush()
|
||||||
{
|
{
|
||||||
bool anyNew = false;
|
bool anyNew = false;
|
||||||
|
|
||||||
cLog(lsINFO) << "Flushing validations";
|
cLog(lsINFO) << "Flushing validations";
|
||||||
boost::mutex::scoped_lock sl(mValidationLock);
|
boost::mutex::scoped_lock sl(mValidationLock);
|
||||||
BOOST_FOREACH(u160_val_pair& it, mCurrentValidations)
|
BOOST_FOREACH(u160_val_pair& it, mCurrentValidations)
|
||||||
{
|
{
|
||||||
if (it.second)
|
if (it.second)
|
||||||
mStaleValidations.push_back(it.second);
|
mStaleValidations.push_back(it.second);
|
||||||
anyNew = true;
|
anyNew = true;
|
||||||
}
|
}
|
||||||
mCurrentValidations.clear();
|
mCurrentValidations.clear();
|
||||||
if (anyNew)
|
if (anyNew)
|
||||||
condWrite();
|
condWrite();
|
||||||
while (mWriting)
|
while (mWriting)
|
||||||
{
|
{
|
||||||
sl.unlock();
|
sl.unlock();
|
||||||
boost::this_thread::sleep(boost::posix_time::milliseconds(100));
|
boost::this_thread::sleep(boost::posix_time::milliseconds(100));
|
||||||
sl.lock();
|
sl.lock();
|
||||||
}
|
}
|
||||||
cLog(lsDEBUG) << "Validations flushed";
|
cLog(lsDEBUG) << "Validations flushed";
|
||||||
}
|
}
|
||||||
|
|
||||||
void ValidationCollection::condWrite()
|
void ValidationCollection::condWrite()
|
||||||
|
|||||||
Reference in New Issue
Block a user