Reformatting using AStyle

This commit is contained in:
Vinnie Falco
2013-06-14 08:45:13 -07:00
parent 36bd8f7173
commit 521e812fc4
294 changed files with 54609 additions and 47598 deletions

View File

@@ -1,95 +1,105 @@
void TXQEntry::addCallbacks(const TXQEntry& otherEntry)
void TXQEntry::addCallbacks (const TXQEntry& otherEntry)
{
BOOST_FOREACH(const stCallback& callback, otherEntry.mCallbacks)
mCallbacks.push_back(callback);
BOOST_FOREACH (const stCallback & callback, otherEntry.mCallbacks)
mCallbacks.push_back (callback);
}
void TXQEntry::doCallbacks(TER result)
void TXQEntry::doCallbacks (TER result)
{
BOOST_FOREACH(const stCallback& callback, mCallbacks)
callback(mTxn, result);
BOOST_FOREACH (const stCallback & callback, mCallbacks)
callback (mTxn, result);
}
bool TXQueue::addEntryForSigCheck(TXQEntry::ref entry)
{ // we always dispatch a thread to check the signature
boost::mutex::scoped_lock sl(mLock);
if (!mTxMap.insert(valueType(entry->getID(), entry)).second)
{
if (!entry->mCallbacks.empty())
mTxMap.left.find(entry->getID())->second->addCallbacks(*entry);
return false;
}
return true;
}
bool TXQueue::addEntryForExecution(TXQEntry::ref entry)
bool TXQueue::addEntryForSigCheck (TXQEntry::ref entry)
{
boost::mutex::scoped_lock sl(mLock);
// we always dispatch a thread to check the signature
boost::mutex::scoped_lock sl (mLock);
entry->mSigChecked = true;
if (!mTxMap.insert (valueType (entry->getID (), entry)).second)
{
if (!entry->mCallbacks.empty ())
mTxMap.left.find (entry->getID ())->second->addCallbacks (*entry);
std::pair<mapType::iterator, bool> it = mTxMap.insert(valueType(entry->getID(), entry));
if (!it.second)
{ // There was an existing entry
it.first->right->mSigChecked = true;
if (!entry->mCallbacks.empty())
it.first->right->addCallbacks(*entry);
}
return false;
}
if (mRunning)
return false;
mRunning = true;
return true; // A thread needs to handle this account
return true;
}
TXQEntry::pointer TXQueue::removeEntry(uint256 const& id)
bool TXQueue::addEntryForExecution (TXQEntry::ref entry)
{
TXQEntry::pointer ret;
boost::mutex::scoped_lock sl (mLock);
boost::mutex::scoped_lock sl(mLock);
entry->mSigChecked = true;
mapType::left_map::iterator it = mTxMap.left.find(id);
if (it != mTxMap.left.end())
{
ret = it->second;
mTxMap.left.erase(it);
}
std::pair<mapType::iterator, bool> it = mTxMap.insert (valueType (entry->getID (), entry));
return ret;
if (!it.second)
{
// There was an existing entry
it.first->right->mSigChecked = true;
if (!entry->mCallbacks.empty ())
it.first->right->addCallbacks (*entry);
}
if (mRunning)
return false;
mRunning = true;
return true; // A thread needs to handle this account
}
void TXQueue::getJob(TXQEntry::pointer &job)
TXQEntry::pointer TXQueue::removeEntry (uint256 const& id)
{
boost::mutex::scoped_lock sl(mLock);
assert(mRunning);
TXQEntry::pointer ret;
if (job)
mTxMap.left.erase(job->getID());
boost::mutex::scoped_lock sl (mLock);
mapType::left_map::iterator it = mTxMap.left.begin();
if (it == mTxMap.left.end() || !it->second->mSigChecked)
{
job.reset();
mRunning = false;
}
else
job = it->second;
mapType::left_map::iterator it = mTxMap.left.find (id);
if (it != mTxMap.left.end ())
{
ret = it->second;
mTxMap.left.erase (it);
}
return ret;
}
bool TXQueue::stopProcessing(TXQEntry::ref finishedJob)
{ // returns true if a new thread must be dispatched
boost::mutex::scoped_lock sl(mLock);
assert(mRunning);
void TXQueue::getJob (TXQEntry::pointer& job)
{
boost::mutex::scoped_lock sl (mLock);
assert (mRunning);
mTxMap.left.erase(finishedJob->getID());
if (job)
mTxMap.left.erase (job->getID ());
mapType::left_map::iterator it = mTxMap.left.begin();
if ((it != mTxMap.left.end()) && it->second->mSigChecked)
return true;
mapType::left_map::iterator it = mTxMap.left.begin ();
mRunning = false;
return false;
if (it == mTxMap.left.end () || !it->second->mSigChecked)
{
job.reset ();
mRunning = false;
}
else
job = it->second;
}
bool TXQueue::stopProcessing (TXQEntry::ref finishedJob)
{
// returns true if a new thread must be dispatched
boost::mutex::scoped_lock sl (mLock);
assert (mRunning);
mTxMap.left.erase (finishedJob->getID ());
mapType::left_map::iterator it = mTxMap.left.begin ();
if ((it != mTxMap.left.end ()) && it->second->mSigChecked)
return true;
mRunning = false;
return false;
}