20 #include <ripple/basics/Slice.h>
21 #include <ripple/basics/chrono.h>
22 #include <ripple/beast/unit_test.h>
23 #include <ripple/core/Config.h>
24 #include <ripple/peerfinder/impl/Logic.h>
25 #include <ripple/protocol/PublicKey.h>
26 #include <ripple/protocol/SecretKey.h>
27 #include <test/unit_test/SuiteJournal.h>
30 namespace PeerFinder {
67 template <
class Handler>
71 boost::system::error_code ec;
79 auto const seconds = 10000;
80 testcase(
"backoff 1");
99 BEAST_EXPECT(list.size() == 1);
110 BEAST_EXPECT(n < 20);
117 auto const seconds = 10000;
118 testcase(
"backoff 2");
140 BEAST_EXPECT(list.size() == 1);
157 BEAST_EXPECT(n <= (seconds + 59) / 60);
181 max = maxPeers.value();
184 "\n" +
"[peers_out_max]\n" +
187 else if (maxIn && maxOut)
204 counts.
out_max() == expectOut &&
206 config.
ipLimit == expectIpLimit);
219 run(
"legacy no config", {}, {}, {}, 4000, 10, 11, 2);
220 run(
"legacy max_peers 0", 0, 100, 10, 4000, 10, 11, 2);
221 run(
"legacy max_peers 5", 5, 100, 10, 4000, 10, 0, 1);
222 run(
"legacy max_peers 20", 20, 100, 10, 4000, 10, 10, 2);
223 run(
"legacy max_peers 100", 100, 100, 10, 4000, 15, 85, 6);
224 run(
"legacy max_peers 20, private", 20, 100, 10, 0, 20, 0, 1);
227 run(
"new in 100/out 10", {}, 100, 10, 4000, 10, 100, 6);
228 run(
"new in 0/out 10", {}, 0, 10, 4000, 10, 0, 1);
229 run(
"new in 100/out 10, private", {}, 100, 10, 0, 10, 0, 6);
235 testcase(
"invalid config");