Structure to charge and credit for load types.

This commit is contained in:
JoelKatz
2012-12-05 15:45:07 -08:00
parent 20b96613e4
commit 3b7bf171ed
3 changed files with 31 additions and 7 deletions

View File

@@ -70,6 +70,7 @@ bool LoadManager::shouldWarn(LoadSource& source) const
canonicalize(source, now);
if (source.isPrivileged() || (source.mBalance < mDebitWarn) || (source.mLastWarning == now))
return false;
source.mLastWarning = now;
return true;
}
@@ -84,7 +85,7 @@ bool LoadManager::shouldCutoff(LoadSource& source) const
}
bool LoadManager::adjust(LoadSource& source, int credits) const
{
{ // return: true = need to warn/cutoff
time_t now = time(NULL);
boost::mutex::scoped_lock sl(mLock);