20 #include <ripple/basics/chrono.h>
21 #include <ripple/basics/Slice.h>
22 #include <ripple/protocol/PublicKey.h>
23 #include <ripple/protocol/SecretKey.h>
24 #include <ripple/peerfinder/impl/Logic.h>
25 #include <ripple/beast/unit_test.h>
26 #include <test/unit_test/SuiteJournal.h>
29 namespace PeerFinder {
37 :
journal_ (
"PeerFinder_test", *this)
66 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);
146 if (! BEAST_EXPECT(logic.
activate(slot, pk,
false) ==
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