From 9cafb7a2a6bfb268de24f79e385fdf85d89f8ee2 Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Sun, 10 Mar 2013 19:05:22 -0700 Subject: [PATCH] Fix load manager buglets. --- src/cpp/ripple/LoadManager.cpp | 2 +- src/cpp/ripple/WSConnection.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/cpp/ripple/LoadManager.cpp b/src/cpp/ripple/LoadManager.cpp index e604e052ec..7bc23eb858 100644 --- a/src/cpp/ripple/LoadManager.cpp +++ b/src/cpp/ripple/LoadManager.cpp @@ -152,7 +152,7 @@ bool LoadManager::shouldCutoff(LoadSource& source) const boost::mutex::scoped_lock sl(mLock); int now = upTime(); canonicalize(source, now); - if (!source.isPrivileged() || (source.mBalance > mDebitLimit)) + if (source.isPrivileged() || (source.mBalance > mDebitLimit)) return false; } logDisconnect(source.getName()); diff --git a/src/cpp/ripple/WSConnection.h b/src/cpp/ripple/WSConnection.h index 10b8be406b..bc928d713c 100644 --- a/src/cpp/ripple/WSConnection.h +++ b/src/cpp/ripple/WSConnection.h @@ -110,7 +110,7 @@ public: jvResult["id"] = jvRequest["id"]; } - theApp->getLoadManager().adjust(mLoadSource, 5); + theApp->getLoadManager().adjust(mLoadSource, -5); return jvResult; } @@ -131,7 +131,7 @@ public: jvResult["result"] = mRPCHandler.doCommand(jvRequest, iRole, cost); } - if (theApp->getLoadManager().adjust(mLoadSource, cost) && theApp->getLoadManager().shouldWarn(mLoadSource)) + if (theApp->getLoadManager().adjust(mLoadSource, -cost) && theApp->getLoadManager().shouldWarn(mLoadSource)) jvResult["warning"] = "load"; // Currently we will simply unwrap errors returned by the RPC