Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposed 1.1.0-b5 #2629

Merged
merged 17 commits into from Jul 27, 2018
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.
+27 −18
Diff settings

Always

Just for now

Improve charge handling in NoRippleCheckLimits test (RIPD-1641)

  • Loading branch information...
mellery451 authored and nbougalis committed Jun 20, 2018
commit 49bcdda41881f6cac140879a236be6ac1a7a734d
@@ -254,27 +254,36 @@ class NoRippleCheckLimits_test : public beast::unit_test::suite
env (fset (alice, asfDefaultRipple));
env.close ();

for (auto i = 0; i < ripple::RPC::Tuning::noRippleCheck.rmax + 5; ++i)
auto checkBalance = [&env]()
{
if (! admin)
// this is endpoint drop prevention. Non admin ports will drop
// requests if they are coming too fast, so we manipulate the
// resource manager here to reset the enpoint balance (for
// localhost) if we get too close to the drop limit. It would
// be better if we could add this functionality to Env somehow
// or otherwise disable endpoint charging for certain test
// cases.
using namespace ripple::Resource;
using namespace std::chrono;
using namespace beast::IP;
auto c = env.app ().getResourceManager ()
.newInboundEndpoint (
Endpoint::from_string (test::getEnvLocalhostAddr()));

// if we go above the warning threshold, reset
if (c.balance() > warningThreshold)
{
// endpoint drop prevention. Non admin ports will drop requests
// if they are coming too fast, so we manipulate the resource
// manager here to reset the enpoint balance (for localhost) if
// we get too close to the drop limit.
using namespace ripple::Resource;
using namespace std::chrono;
using namespace beast::IP;
auto c = env.app().getResourceManager()
.newInboundEndpoint (Endpoint::from_string (test::getEnvLocalhostAddr()));
if (dropThreshold - c.balance() <= 20)
{
using clock_type = beast::abstract_clock <steady_clock>;
c.entry().local_balance =
DecayingSample <decayWindowSeconds, clock_type>
{steady_clock::now()};
}
using clock_type = beast::abstract_clock <steady_clock>;
c.entry().local_balance =
DecayingSample <decayWindowSeconds, clock_type>
{steady_clock::now()};
}
};

for (auto i = 0; i < ripple::RPC::Tuning::noRippleCheck.rmax + 5; ++i)
{
if (! admin)
checkBalance();

auto& txq = env.app().getTxQ();
auto const gw = Account {"gw" + std::to_string(i)};
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.