20 #include <ripple/basics/Slice.h>
21 #include <ripple/basics/chrono.h>
22 #include <ripple/beast/unit_test.h>
23 #include <ripple/peerfinder/impl/Logic.h>
24 #include <ripple/protocol/PublicKey.h>
25 #include <ripple/protocol/SecretKey.h>
26 #include <test/unit_test/SuiteJournal.h>
29 namespace PeerFinder {
66 template <
class Handler>
70 boost::system::error_code ec;
78 auto const seconds = 10000;
79 testcase(
"backoff 1");
98 BEAST_EXPECT(list.size() == 1);
109 BEAST_EXPECT(n < 20);
116 auto const seconds = 10000;
117 testcase(
"backoff 2");
139 BEAST_EXPECT(list.size() == 1);
156 BEAST_EXPECT(n <= (seconds + 59) / 60);
void save(std::vector< Entry > const &) override
The Logic for maintaining the list of Slot addresses.
SlotImp::ptr new_outbound_slot(beast::IP::Endpoint const &remote_endpoint)
test::SuiteJournal journal_
Abstract persistence for PeerFinder data.
bool onConnected(SlotImp::ptr const &slot, beast::IP::Endpoint const &local_endpoint)
std::vector< beast::IP::Endpoint > autoconnect()
Create new outbound connection attempts as needed.
void addFixedPeer(std::string const &name, beast::IP::Endpoint const &ep)
Result activate(SlotImp::ptr const &slot, PublicKey const &key, bool reserved)
void async_connect(beast::IP::Endpoint const &ep, Handler &&handler)
std::pair< PublicKey, SecretKey > randomKeyPair(KeyType type)
Create a key pair using secure random numbers.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
std::uint16_t listeningPort
The listening port number.
static Endpoint from_string(std::string const &s)
BEAST_DEFINE_TESTSUITE(Livecache, peerfinder, ripple)
A version-independent IP address and port combination.
bool autoConnect
true if we want to establish connections automatically
PeerFinder configuration settings.
void on_closed(SlotImp::ptr const &slot)
void config(Config const &c)
std::size_t load(load_callback const &cb) override