rippled
|
The Logic for maintaining the list of Slot addresses. More...
Public Types | |
using | Slots = std::map< beast::IP::Endpoint, std::shared_ptr< SlotImp > > |
Public Member Functions | |
Logic (clock_type &clock, Store &store, Checker &checker, beast::Journal journal) | |
void | load () |
void | stop () |
Stop the logic. More... | |
void | config (Config const &c) |
Config | config () |
void | addFixedPeer (std::string const &name, beast::IP::Endpoint const &ep) |
void | addFixedPeer (std::string const &name, std::vector< beast::IP::Endpoint > const &addresses) |
void | checkComplete (beast::IP::Endpoint const &remoteAddress, beast::IP::Endpoint const &checkedAddress, boost::system::error_code ec) |
SlotImp::ptr | new_inbound_slot (beast::IP::Endpoint const &local_endpoint, beast::IP::Endpoint const &remote_endpoint) |
SlotImp::ptr | new_outbound_slot (beast::IP::Endpoint const &remote_endpoint) |
bool | onConnected (SlotImp::ptr const &slot, beast::IP::Endpoint const &local_endpoint) |
Result | activate (SlotImp::ptr const &slot, PublicKey const &key, bool reserved) |
std::vector< Endpoint > | redirect (SlotImp::ptr const &slot) |
Return a list of addresses suitable for redirection. More... | |
std::vector< beast::IP::Endpoint > | autoconnect () |
Create new outbound connection attempts as needed. More... | |
std::vector< std::pair< std::shared_ptr< Slot >, std::vector< Endpoint > > > | buildEndpointsForPeers () |
void | once_per_second () |
void | preprocess (SlotImp::ptr const &slot, Endpoints &list) |
void | on_endpoints (SlotImp::ptr const &slot, Endpoints list) |
void | remove (SlotImp::ptr const &slot) |
void | on_closed (SlotImp::ptr const &slot) |
void | on_failure (SlotImp::ptr const &slot) |
template<class FwdIter > | |
void | onRedirects (FwdIter first, FwdIter last, boost::asio::ip::tcp::endpoint const &remote_address) |
bool | fixed (beast::IP::Endpoint const &endpoint) const |
bool | fixed (beast::IP::Address const &address) const |
template<class Container > | |
void | get_fixed (std::size_t needed, Container &c, typename ConnectHandouts::Squelches &squelches) |
Adds eligible Fixed addresses for outbound attempts. More... | |
void | addStaticSource (std::shared_ptr< Source > const &source) |
void | addSource (std::shared_ptr< Source > const &source) |
int | addBootcacheAddresses (IPAddresses const &list) |
void | fetch (std::shared_ptr< Source > const &source) |
bool | is_valid_address (beast::IP::Endpoint const &address) |
void | writeSlots (beast::PropertyStream::Set &set, Slots const &slots) |
void | onWrite (beast::PropertyStream::Map &map) |
Counts const & | counts () const |
Static Public Member Functions | |
static std::string | stateString (Slot::State state) |
The Logic for maintaining the list of Slot addresses.
We keep this in a separate class so it can be instantiated for unit tests.
Definition at line 54 of file peerfinder/impl/Logic.h.
using ripple::PeerFinder::Logic< Checker >::Slots = std::map<beast::IP::Endpoint, std::shared_ptr<SlotImp> > |
Definition at line 60 of file peerfinder/impl/Logic.h.
ripple::PeerFinder::Logic< Checker >::Logic | ( | clock_type & | clock, |
Store & | store, | ||
Checker & | checker, | ||
beast::Journal | journal | ||
) |
Definition at line 111 of file peerfinder/impl/Logic.h.
void ripple::PeerFinder::Logic< Checker >::load | ( | ) |
Definition at line 131 of file peerfinder/impl/Logic.h.
void ripple::PeerFinder::Logic< Checker >::stop | ( | ) |
Stop the logic.
This will cancel the current fetch and set the stopping flag to true
to prevent further fetches. Thread safety: Safe to call from any thread.
Definition at line 144 of file peerfinder/impl/Logic.h.
void ripple::PeerFinder::Logic< Checker >::config | ( | Config const & | c | ) |
Definition at line 159 of file peerfinder/impl/Logic.h.
Config ripple::PeerFinder::Logic< Checker >::config | ( | ) |
Definition at line 167 of file peerfinder/impl/Logic.h.
void ripple::PeerFinder::Logic< Checker >::addFixedPeer | ( | std::string const & | name, |
beast::IP::Endpoint const & | ep | ||
) |
Definition at line 174 of file peerfinder/impl/Logic.h.
void ripple::PeerFinder::Logic< Checker >::addFixedPeer | ( | std::string const & | name, |
std::vector< beast::IP::Endpoint > const & | addresses | ||
) |
Definition at line 182 of file peerfinder/impl/Logic.h.
void ripple::PeerFinder::Logic< Checker >::checkComplete | ( | beast::IP::Endpoint const & | remoteAddress, |
beast::IP::Endpoint const & | checkedAddress, | ||
boost::system::error_code | ec | ||
) |
Definition at line 223 of file peerfinder/impl/Logic.h.
SlotImp::ptr ripple::PeerFinder::Logic< Checker >::new_inbound_slot | ( | beast::IP::Endpoint const & | local_endpoint, |
beast::IP::Endpoint const & | remote_endpoint | ||
) |
Definition at line 266 of file peerfinder/impl/Logic.h.
SlotImp::ptr ripple::PeerFinder::Logic< Checker >::new_outbound_slot | ( | beast::IP::Endpoint const & | remote_endpoint | ) |
Definition at line 311 of file peerfinder/impl/Logic.h.
bool ripple::PeerFinder::Logic< Checker >::onConnected | ( | SlotImp::ptr const & | slot, |
beast::IP::Endpoint const & | local_endpoint | ||
) |
Definition at line 346 of file peerfinder/impl/Logic.h.
Result ripple::PeerFinder::Logic< Checker >::activate | ( | SlotImp::ptr const & | slot, |
PublicKey const & | key, | ||
bool | reserved | ||
) |
Definition at line 383 of file peerfinder/impl/Logic.h.
std::vector<Endpoint> ripple::PeerFinder::Logic< Checker >::redirect | ( | SlotImp::ptr const & | slot | ) |
Return a list of addresses suitable for redirection.
This is a legacy function, redirects should be returned in the HTTP handshake and not via TMEndpoints.
Definition at line 451 of file peerfinder/impl/Logic.h.
std::vector<beast::IP::Endpoint> ripple::PeerFinder::Logic< Checker >::autoconnect | ( | ) |
Create new outbound connection attempts as needed.
This implements PeerFinder's "Outbound Connection Strategy"
Definition at line 467 of file peerfinder/impl/Logic.h.
std::vector<std::pair<std::shared_ptr<Slot>, std::vector<Endpoint> > > ripple::PeerFinder::Logic< Checker >::buildEndpointsForPeers | ( | ) |
Definition at line 581 of file peerfinder/impl/Logic.h.
void ripple::PeerFinder::Logic< Checker >::once_per_second | ( | ) |
Definition at line 672 of file peerfinder/impl/Logic.h.
void ripple::PeerFinder::Logic< Checker >::preprocess | ( | SlotImp::ptr const & | slot, |
Endpoints & | list | ||
) |
Definition at line 693 of file peerfinder/impl/Logic.h.
void ripple::PeerFinder::Logic< Checker >::on_endpoints | ( | SlotImp::ptr const & | slot, |
Endpoints | list | ||
) |
Definition at line 763 of file peerfinder/impl/Logic.h.
void ripple::PeerFinder::Logic< Checker >::remove | ( | SlotImp::ptr const & | slot | ) |
Definition at line 856 of file peerfinder/impl/Logic.h.
void ripple::PeerFinder::Logic< Checker >::on_closed | ( | SlotImp::ptr const & | slot | ) |
Definition at line 887 of file peerfinder/impl/Logic.h.
void ripple::PeerFinder::Logic< Checker >::on_failure | ( | SlotImp::ptr const & | slot | ) |
Definition at line 938 of file peerfinder/impl/Logic.h.
void ripple::PeerFinder::Logic< Checker >::onRedirects | ( | FwdIter | first, |
FwdIter | last, | ||
boost::asio::ip::tcp::endpoint const & | remote_address | ||
) |
Definition at line 1213 of file peerfinder/impl/Logic.h.
bool ripple::PeerFinder::Logic< Checker >::fixed | ( | beast::IP::Endpoint const & | endpoint | ) | const |
Definition at line 958 of file peerfinder/impl/Logic.h.
bool ripple::PeerFinder::Logic< Checker >::fixed | ( | beast::IP::Address const & | address | ) | const |
Definition at line 970 of file peerfinder/impl/Logic.h.
void ripple::PeerFinder::Logic< Checker >::get_fixed | ( | std::size_t | needed, |
Container & | c, | ||
typename ConnectHandouts::Squelches & | squelches | ||
) |
Adds eligible Fixed addresses for outbound attempts.
Definition at line 987 of file peerfinder/impl/Logic.h.
void ripple::PeerFinder::Logic< Checker >::addStaticSource | ( | std::shared_ptr< Source > const & | source | ) |
Definition at line 1015 of file peerfinder/impl/Logic.h.
void ripple::PeerFinder::Logic< Checker >::addSource | ( | std::shared_ptr< Source > const & | source | ) |
Definition at line 1021 of file peerfinder/impl/Logic.h.
int ripple::PeerFinder::Logic< Checker >::addBootcacheAddresses | ( | IPAddresses const & | list | ) |
Definition at line 1036 of file peerfinder/impl/Logic.h.
void ripple::PeerFinder::Logic< Checker >::fetch | ( | std::shared_ptr< Source > const & | source | ) |
Definition at line 1050 of file peerfinder/impl/Logic.h.
bool ripple::PeerFinder::Logic< Checker >::is_valid_address | ( | beast::IP::Endpoint const & | address | ) |
Definition at line 1099 of file peerfinder/impl/Logic.h.
void ripple::PeerFinder::Logic< Checker >::writeSlots | ( | beast::PropertyStream::Set & | set, |
Slots const & | slots | ||
) |
Definition at line 1117 of file peerfinder/impl/Logic.h.
void ripple::PeerFinder::Logic< Checker >::onWrite | ( | beast::PropertyStream::Map & | map | ) |
Definition at line 1138 of file peerfinder/impl/Logic.h.
Counts const& ripple::PeerFinder::Logic< Checker >::counts | ( | ) | const |
Definition at line 1181 of file peerfinder/impl/Logic.h.
|
static |
Definition at line 1187 of file peerfinder/impl/Logic.h.
beast::Journal ripple::PeerFinder::Logic< Checker >::m_journal |
Definition at line 62 of file peerfinder/impl/Logic.h.
clock_type& ripple::PeerFinder::Logic< Checker >::m_clock |
Definition at line 63 of file peerfinder/impl/Logic.h.
Store& ripple::PeerFinder::Logic< Checker >::m_store |
Definition at line 64 of file peerfinder/impl/Logic.h.
Checker& ripple::PeerFinder::Logic< Checker >::m_checker |
Definition at line 65 of file peerfinder/impl/Logic.h.
std::recursive_mutex ripple::PeerFinder::Logic< Checker >::lock_ |
Definition at line 67 of file peerfinder/impl/Logic.h.
bool ripple::PeerFinder::Logic< Checker >::stopping_ = false |
Definition at line 70 of file peerfinder/impl/Logic.h.
std::shared_ptr<Source> ripple::PeerFinder::Logic< Checker >::fetchSource_ |
Definition at line 74 of file peerfinder/impl/Logic.h.
Config ripple::PeerFinder::Logic< Checker >::config_ |
Definition at line 77 of file peerfinder/impl/Logic.h.
Counts ripple::PeerFinder::Logic< Checker >::counts_ |
Definition at line 80 of file peerfinder/impl/Logic.h.
std::map<beast::IP::Endpoint, Fixed> ripple::PeerFinder::Logic< Checker >::fixed_ |
Definition at line 83 of file peerfinder/impl/Logic.h.
Livecache ripple::PeerFinder::Logic< Checker >::livecache_ |
Definition at line 86 of file peerfinder/impl/Logic.h.
Bootcache ripple::PeerFinder::Logic< Checker >::bootcache_ |
Definition at line 89 of file peerfinder/impl/Logic.h.
Slots ripple::PeerFinder::Logic< Checker >::slots_ |
Definition at line 92 of file peerfinder/impl/Logic.h.
std::multiset<beast::IP::Address> ripple::PeerFinder::Logic< Checker >::connectedAddresses_ |
Definition at line 97 of file peerfinder/impl/Logic.h.
std::set<PublicKey> ripple::PeerFinder::Logic< Checker >::keys_ |
Definition at line 100 of file peerfinder/impl/Logic.h.
std::vector<std::shared_ptr<Source> > ripple::PeerFinder::Logic< Checker >::m_sources |
Definition at line 103 of file peerfinder/impl/Logic.h.
clock_type::time_point ripple::PeerFinder::Logic< Checker >::m_whenBroadcast |
Definition at line 105 of file peerfinder/impl/Logic.h.
ConnectHandouts::Squelches ripple::PeerFinder::Logic< Checker >::m_squelches |
Definition at line 107 of file peerfinder/impl/Logic.h.