Tie the peer code into the new load management code.

This commit is contained in:
JoelKatz
2012-12-10 06:27:52 -08:00
parent 5cbc8f0018
commit 35ec825d8c
5 changed files with 79 additions and 52 deletions

View File

@@ -101,6 +101,12 @@ bool LoadManager::shouldCutoff(LoadSource& source) const
return !source.isPrivileged() && (source.mBalance < mDebitLimit);
}
bool LoadManager::adjust(LoadSource& source, LoadType t) const
{ // FIXME: Scale by category
LoadCost cost = mCosts[static_cast<int>(t)];
return adjust(source, cost.mCost);
}
bool LoadManager::adjust(LoadSource& source, int credits) const
{ // return: true = need to warn/cutoff
time_t now = time(NULL);