summaryrefslogtreecommitdiff
path: root/selftest.cpp
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2013-08-30 17:05:43 -0400
committerAdam Ierymenko <adam.ierymenko@gmail.com>2013-08-30 17:05:43 -0400
commitf3ad05347e55de2fd2a500464acde0979df9941f (patch)
tree57376b3114e193201dcfe2d08ef2a5bdb693ad30 /selftest.cpp
parent1a7e303f97507842c1a0bfffb27b76277bd43bab (diff)
downloadinfinitytier-f3ad05347e55de2fd2a500464acde0979df9941f.tar.gz
infinitytier-f3ad05347e55de2fd2a500464acde0979df9941f.zip
Improve code security posture by replacing sprintf with a safer function.
Diffstat (limited to 'selftest.cpp')
-rw-r--r--selftest.cpp27
1 files changed, 0 insertions, 27 deletions
diff --git a/selftest.cpp b/selftest.cpp
index 64189862..c9ca9c71 100644
--- a/selftest.cpp
+++ b/selftest.cpp
@@ -376,32 +376,6 @@ static int testOther()
return 0;
}
-static int testRateLimiter()
-{
- RateLimiter limiter;
- RateLimiter::Limit limit;
-
- std::cout << "[ratelimiter] preload: 10000.0, rate: 1000.0/sec, max: 15000.0, min: -7500.0" << std::endl;
- limit.bytesPerSecond = 1000.0;
- limit.maxBalance = 15000.0;
- limit.minBalance = -7500.0;
- limiter.init(10000.0);
- for(int i=0;i<25;++i) {
- Thread::sleep(100);
- std::cout << "[ratelimiter] delayed 0.1s, gate(1000.0): " << (limiter.gate(limit,1000.0) ? "OK" : "BLOCK");
- std::cout << " (new balance afterwords: " << limiter.balance() << ")" << std::endl;
- }
- std::cout << "[ratelimiter] delaying 15s..." << std::endl;
- Thread::sleep(15000);
- for(int i=0;i<20;++i) {
- Thread::sleep(1000);
- std::cout << "[ratelimiter] delayed 1s, gate(2000.0): " << (limiter.gate(limit,2000.0) ? "OK" : "BLOCK");
- std::cout << " (new balance afterwords: " << limiter.balance() << ")" << std::endl;
- }
-
- return 0;
-}
-
#ifdef __WINDOWS__
int _tmain(int argc, _TCHAR* argv[])
#else
@@ -417,7 +391,6 @@ int main(int argc,char **argv)
r |= testPacket();
r |= testOther();
r |= testIdentity();
- r |= testRateLimiter();
if (r)
std::cout << std::endl << "SOMETHING FAILED!" << std::endl;