Log when we would disconnected, but don't actually disconnect for now.

This commit is contained in:
JoelKatz
2013-03-10 19:15:28 -07:00
parent 4b449b5c99
commit 92318a47bd
3 changed files with 16 additions and 2 deletions

View File

@@ -124,7 +124,10 @@ void LoadManager::canonicalize(LoadSource& source, int now) const
{
source.mBalance += mCreditRate * (now - source.mLastUpdate);
if (source.mBalance > mCreditLimit)
{
source.mBalance = mCreditLimit;
source.mLogged = false;
}
}
source.mLastUpdate = now;
}
@@ -154,6 +157,9 @@ bool LoadManager::shouldCutoff(LoadSource& source) const
canonicalize(source, now);
if (source.isPrivileged() || (source.mBalance > mDebitLimit))
return false;
if (source.mLogged)
return true;
source.mLogged = true;
}
logDisconnect(source.getName());
return true;