From b576a32e7d95715c73667d7d15d91a6b29fa335e Mon Sep 17 00:00:00 2001 From: intelliot Date: Wed, 18 Oct 2023 06:00:17 +0000 Subject: [PATCH] deploy: 41cd337506f24630a55b628f2ac0df541081c818 --- PeerFinder__test_8cpp_source.html | 6 +- PeerfinderManager_8cpp_source.html | 20 +- TER_8h_source.html | 4 +- classripple_1_1PeerFinder_1_1Logic.html | 44 +- namespacemembers_eval_t.html | 4 +- namespacemembers_t.html | 4 +- namespaceripple.html | 4 +- peerfinder_2impl_2Logic_8h_source.html | 1630 ++++++++++++----------- search/all_14.js | 2 +- search/enumvalues_13.js | 2 +- 10 files changed, 870 insertions(+), 850 deletions(-) diff --git a/PeerFinder__test_8cpp_source.html b/PeerFinder__test_8cpp_source.html index bf49512ef2..fb1a356241 100644 --- a/PeerFinder__test_8cpp_source.html +++ b/PeerFinder__test_8cpp_source.html @@ -388,7 +388,7 @@ $(function() {
PeerFinder_test()
T to_string(T... args)
void test_backoff2()
-
std::vector< beast::IP::Endpoint > autoconnect()
Create new outbound connection attempts as needed.
+
std::vector< beast::IP::Endpoint > autoconnect()
Create new outbound connection attempts as needed.
void onConfig(Config const &config)
Called when the config is set or changed.
Definition: Counts.h:135
std::size_t PEERS_OUT_MAX
Definition: Config.h:190
void addFixedPeer(std::string const &name, beast::IP::Endpoint const &ep)
@@ -399,7 +399,7 @@ $(function() {
Definition: SuiteJournal.h:88
@ secp256k1
std::pair< PublicKey, SecretKey > randomKeyPair(KeyType type)
Create a key pair using secure random numbers.
Definition: SecretKey.cpp:368
-
void once_per_second()
+
void once_per_second()
std::size_t PEERS_MAX
Definition: Config.h:189
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
std::uint16_t listeningPort
The listening port number.
@@ -412,7 +412,7 @@ $(function() {
A version-independent IP address and port combination.
Definition: IPEndpoint.h:38
bool autoConnect
true if we want to establish connections automatically
PeerFinder configuration settings.
-
void on_closed(SlotImp::ptr const &slot)
+
void on_closed(SlotImp::ptr const &slot)
void config(Config const &c)
int ipLimit
Limit how many incoming connections we allow per IP.
diff --git a/PeerfinderManager_8cpp_source.html b/PeerfinderManager_8cpp_source.html index c66ef7977f..13e972dcf6 100644 --- a/PeerfinderManager_8cpp_source.html +++ b/PeerfinderManager_8cpp_source.html @@ -368,9 +368,9 @@ $(function() {
Database persistence for PeerFinder using SQLite.
Definition: StoreSqdb.h:33
SlotImp::ptr new_outbound_slot(beast::IP::Endpoint const &remote_endpoint)
-
void on_failure(SlotImp::ptr const &slot)
+
void on_failure(SlotImp::ptr const &slot)
bool onConnected(std::shared_ptr< Slot > const &slot, beast::IP::Endpoint const &local_endpoint) override
Called when an outbound connection attempt succeeds.
-
void onRedirects(FwdIter first, FwdIter last, boost::asio::ip::tcp::endpoint const &remote_address)
+
void onRedirects(FwdIter first, FwdIter last, boost::asio::ip::tcp::endpoint const &remote_address)
STL class.
std::optional< boost::asio::io_service::work > work_
beast::insight::Gauge activeOutboundPeers
@@ -390,18 +390,18 @@ $(function() {
void stop() override
Transition to the stopped state, synchronously.
A public key.
Definition: PublicKey.h:61
void on_closed(std::shared_ptr< Slot > const &slot) override
Called when the slot is closed.
-
void addStaticSource(std::shared_ptr< Source > const &source)
-
std::vector< std::pair< std::shared_ptr< Slot >, std::vector< Endpoint > > > buildEndpointsForPeers()
+
void addStaticSource(std::shared_ptr< Source > const &source)
+
std::vector< std::pair< std::shared_ptr< Slot >, std::vector< Endpoint > > > buildEndpointsForPeers()
clock_type & m_clock
-
std::vector< Endpoint > redirect(SlotImp::ptr const &slot)
Return a list of addresses suitable for redirection.
-
void onWrite(beast::PropertyStream::Map &map)
+
std::vector< Endpoint > redirect(SlotImp::ptr const &slot)
Return a list of addresses suitable for redirection.
+
void onWrite(beast::PropertyStream::Map &map)
int out_active() const
Returns the number of outbound peers assigned an open slot.
Definition: Counts.h:112
void start() override
Transition to the started state, synchronously.
std::unique_ptr< Manager > make_Manager(boost::asio::io_service &io_service, clock_type &clock, beast::Journal journal, BasicConfig const &config, beast::insight::Collector::ptr const &collector)
Create a new Manager.
void stop()
Stop the logic.
Counts counts_
boost::asio::io_service & io_service_
-
std::vector< beast::IP::Endpoint > autoconnect()
Create new outbound connection attempts as needed.
+
std::vector< beast::IP::Endpoint > autoconnect()
Create new outbound connection attempts as needed.
void addFixedPeer(std::string const &name, beast::IP::Endpoint const &ep)
A generic endpoint for log messages.
Definition: Journal.h:58
void stop()
Stop the service.
Definition: Checker.h:184
@@ -412,7 +412,7 @@ $(function() {
A metric for measuring an integral value.
Definition: Gauge.h:39
std::vector< std::pair< std::shared_ptr< Slot >, std::vector< Endpoint > > > buildEndpointsForPeers() override
void open(BasicConfig const &config)
Definition: StoreSqdb.h:56
-
void once_per_second()
+
void once_per_second()
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
void on_failure(std::shared_ptr< Slot > const &slot) override
Called when an outbound connection is deemed to have failed.
void once_per_second() override
Perform periodic activity.
@@ -432,7 +432,7 @@ $(function() {
T end(T... args)
void onWrite(beast::PropertyStream::Map &map) override
Subclass override.
PeerFinder configuration settings.
-
void on_closed(SlotImp::ptr const &slot)
+
void on_closed(SlotImp::ptr const &slot)
void config(Config const &c)
void onRedirects(boost::asio::ip::tcp::endpoint const &remote_address, std::vector< boost::asio::ip::tcp::endpoint > const &eps) override
Called when we received redirect IPs from a busy peer.
STL class.
@@ -448,7 +448,7 @@ $(function() {
std::shared_ptr< Slot > new_outbound_slot(beast::IP::Endpoint const &remote_endpoint) override
Create a new outbound slot with the specified remote endpoint.
ManagerImp(boost::asio::io_service &io_service, clock_type &clock, beast::Journal journal, BasicConfig const &config, beast::insight::Collector::ptr const &collector)
std::shared_ptr< Slot > new_inbound_slot(beast::IP::Endpoint const &local_endpoint, beast::IP::Endpoint const &remote_endpoint) override
Add a URL as a fallback location to obtain IP::Endpoint sources.
-
void on_endpoints(SlotImp::ptr const &slot, Endpoints list)
+
void on_endpoints(SlotImp::ptr const &slot, Endpoints list)
Result
Possible results from activating a slot.
Definition: base_uint.h:641
diff --git a/TER_8h_source.html b/TER_8h_source.html index ac5d2c2926..6ce5dcd0ee 100644 --- a/TER_8h_source.html +++ b/TER_8h_source.html @@ -365,7 +365,7 @@ $(function() {
294  tecKILLED = 150,
295  tecHAS_OBLIGATIONS = 151,
296  tecTOO_SOON = 152,
-
297  tecHOOK_ERROR [[maybe_unused]] = 153,
+
297  tecHOOK_REJECTED [[maybe_unused]] = 153,
298  tecMAX_SEQUENCE_REACHED = 154,
299  tecNO_SUITABLE_NFTOKEN_PAGE = 155,
300  tecNFTOKEN_BUY_SELL_MISMATCH = 156,
@@ -768,7 +768,6 @@ $(function() {
@ tecXCHAIN_SENDING_ACCOUNT_MISMATCH
Definition: TER.h:323
@ telBAD_DOMAIN
Definition: TER.h:52
@ temXCHAIN_EQUAL_DOOR_ACCOUNTS
Definition: TER.h:129
-
@ tecHOOK_ERROR
Definition: TER.h:297
Definition: TER.h:540
@ tecDST_TAG_NEEDED
Definition: TER.h:287
constexpr friend TERUnderlyingType TERtoInt(TERSubset v)
Definition: TER.h:461
@@ -781,6 +780,7 @@ $(function() {
@ telCAN_NOT_QUEUE
Definition: TER.h:58
int TERUnderlyingType
Definition: TER.h:37
@ telNETWORK_ID_MAKES_TX_NON_CANONICAL
Definition: TER.h:66
+
@ tecHOOK_REJECTED
Definition: TER.h:297
Definition: TER.h:571
constexpr TERUnderlyingType TERtoInt(TELcodes v)
Definition: TER.h:337
@ tecCANT_ACCEPT_OWN_NFTOKEN_OFFER
Definition: TER.h:302
diff --git a/classripple_1_1PeerFinder_1_1Logic.html b/classripple_1_1PeerFinder_1_1Logic.html index e3af181d0e..fdb2698108 100644 --- a/classripple_1_1PeerFinder_1_1Logic.html +++ b/classripple_1_1PeerFinder_1_1Logic.html @@ -668,7 +668,7 @@ template<class Checker >

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.

+

Definition at line 454 of file peerfinder/impl/Logic.h.

@@ -692,7 +692,7 @@ template<class Checker >

Create new outbound connection attempts as needed.

This implements PeerFinder's "Outbound Connection Strategy"

-

Definition at line 467 of file peerfinder/impl/Logic.h.

+

Definition at line 470 of file peerfinder/impl/Logic.h.

@@ -713,7 +713,7 @@ template<class Checker >
-

Definition at line 581 of file peerfinder/impl/Logic.h.

+

Definition at line 584 of file peerfinder/impl/Logic.h.

@@ -734,7 +734,7 @@ template<class Checker >
-

Definition at line 672 of file peerfinder/impl/Logic.h.

+

Definition at line 675 of file peerfinder/impl/Logic.h.

@@ -766,7 +766,7 @@ template<class Checker >
-

Definition at line 693 of file peerfinder/impl/Logic.h.

+

Definition at line 696 of file peerfinder/impl/Logic.h.

@@ -798,7 +798,7 @@ template<class Checker >
-

Definition at line 763 of file peerfinder/impl/Logic.h.

+

Definition at line 766 of file peerfinder/impl/Logic.h.

@@ -820,7 +820,7 @@ template<class Checker >
-

Definition at line 856 of file peerfinder/impl/Logic.h.

+

Definition at line 859 of file peerfinder/impl/Logic.h.

@@ -842,7 +842,7 @@ template<class Checker >
-

Definition at line 887 of file peerfinder/impl/Logic.h.

+

Definition at line 902 of file peerfinder/impl/Logic.h.

@@ -864,7 +864,7 @@ template<class Checker >
-

Definition at line 938 of file peerfinder/impl/Logic.h.

+

Definition at line 957 of file peerfinder/impl/Logic.h.

@@ -904,7 +904,7 @@ template<class FwdIter >
-

Definition at line 1213 of file peerfinder/impl/Logic.h.

+

Definition at line 1232 of file peerfinder/impl/Logic.h.

@@ -926,7 +926,7 @@ template<class Checker >
-

Definition at line 958 of file peerfinder/impl/Logic.h.

+

Definition at line 977 of file peerfinder/impl/Logic.h.

@@ -948,7 +948,7 @@ template<class Checker >
-

Definition at line 970 of file peerfinder/impl/Logic.h.

+

Definition at line 989 of file peerfinder/impl/Logic.h.

@@ -990,7 +990,7 @@ template<class Container >

Adds eligible Fixed addresses for outbound attempts.

-

Definition at line 987 of file peerfinder/impl/Logic.h.

+

Definition at line 1006 of file peerfinder/impl/Logic.h.

@@ -1012,7 +1012,7 @@ template<class Checker >
-

Definition at line 1015 of file peerfinder/impl/Logic.h.

+

Definition at line 1034 of file peerfinder/impl/Logic.h.

@@ -1034,7 +1034,7 @@ template<class Checker >
-

Definition at line 1021 of file peerfinder/impl/Logic.h.

+

Definition at line 1040 of file peerfinder/impl/Logic.h.

@@ -1056,7 +1056,7 @@ template<class Checker >
-

Definition at line 1036 of file peerfinder/impl/Logic.h.

+

Definition at line 1055 of file peerfinder/impl/Logic.h.

@@ -1078,7 +1078,7 @@ template<class Checker >
-

Definition at line 1050 of file peerfinder/impl/Logic.h.

+

Definition at line 1069 of file peerfinder/impl/Logic.h.

@@ -1100,7 +1100,7 @@ template<class Checker >
-

Definition at line 1099 of file peerfinder/impl/Logic.h.

+

Definition at line 1118 of file peerfinder/impl/Logic.h.

@@ -1132,7 +1132,7 @@ template<class Checker >
-

Definition at line 1117 of file peerfinder/impl/Logic.h.

+

Definition at line 1136 of file peerfinder/impl/Logic.h.

@@ -1154,7 +1154,7 @@ template<class Checker >
-

Definition at line 1138 of file peerfinder/impl/Logic.h.

+

Definition at line 1157 of file peerfinder/impl/Logic.h.

@@ -1175,7 +1175,7 @@ template<class Checker >
-

Definition at line 1181 of file peerfinder/impl/Logic.h.

+

Definition at line 1200 of file peerfinder/impl/Logic.h.

@@ -1205,7 +1205,7 @@ template<class Checker >
-

Definition at line 1187 of file peerfinder/impl/Logic.h.

+

Definition at line 1206 of file peerfinder/impl/Logic.h.

diff --git a/namespacemembers_eval_t.html b/namespacemembers_eval_t.html index ef2015dd00..1d4b301ff0 100644 --- a/namespacemembers_eval_t.html +++ b/namespacemembers_eval_t.html @@ -127,8 +127,8 @@ $(function() {
  • tecHAS_OBLIGATIONS : ripple
  • -
  • tecHOOK_ERROR -: ripple +
  • tecHOOK_REJECTED +: ripple
  • tecINCOMPLETE : ripple diff --git a/namespacemembers_t.html b/namespacemembers_t.html index f2eb33217e..0b27218ce8 100644 --- a/namespacemembers_t.html +++ b/namespacemembers_t.html @@ -151,8 +151,8 @@ $(function() {
  • tecHAS_OBLIGATIONS : ripple
  • -
  • tecHOOK_ERROR -: ripple +
  • tecHOOK_REJECTED +: ripple
  • tecINCOMPLETE : ripple diff --git a/namespaceripple.html b/namespaceripple.html index 10156bb98a..c0cf864c74 100644 --- a/namespaceripple.html +++ b/namespaceripple.html @@ -2397,7 +2397,7 @@ Enumerations
      tecHAS_OBLIGATIONS = 151, tecTOO_SOON = 152, -tecHOOK_ERROR = 153, +tecHOOK_REJECTED = 153, tecMAX_SEQUENCE_REACHED = 154,
      tecNO_SUITABLE_NFTOKEN_PAGE = 155, @@ -9870,7 +9870,7 @@ ledger. tecKILLED  tecHAS_OBLIGATIONS  tecTOO_SOON  -tecHOOK_ERROR  +tecHOOK_REJECTED  tecMAX_SEQUENCE_REACHED  tecNO_SUITABLE_NFTOKEN_PAGE  tecNFTOKEN_BUY_SELL_MISMATCH  diff --git a/peerfinder_2impl_2Logic_8h_source.html b/peerfinder_2impl_2Logic_8h_source.html index e11c8bf38c..0cf86703e7 100644 --- a/peerfinder_2impl_2Logic_8h_source.html +++ b/peerfinder_2impl_2Logic_8h_source.html @@ -477,812 +477,831 @@ $(function() {
    416  // assert later when erasing the key.
    417  slot->public_key(key);
    418  {
    -
    419  auto const result = keys_.insert(key);
    +
    419  [[maybe_unused]] bool const inserted = keys_.insert(key).second;
    420  // Public key must not already exist
    -
    421  assert(result.second);
    -
    422  (void)result.second;
    -
    423  }
    -
    424 
    -
    425  // Change state and update counts
    -
    426  counts_.remove(*slot);
    -
    427  slot->activate(m_clock.now());
    -
    428  counts_.add(*slot);
    -
    429 
    -
    430  if (!slot->inbound())
    -
    431  bootcache_.on_success(slot->remote_endpoint());
    -
    432 
    -
    433  // Mark fixed slot success
    -
    434  if (slot->fixed() && !slot->inbound())
    -
    435  {
    -
    436  auto iter(fixed_.find(slot->remote_endpoint()));
    -
    437  assert(iter != fixed_.end());
    -
    438  iter->second.success(m_clock.now());
    -
    439  JLOG(m_journal.trace()) << beast::leftw(18) << "Logic fixed "
    -
    440  << slot->remote_endpoint() << " success";
    -
    441  }
    -
    442 
    -
    443  return Result::success;
    -
    444  }
    +
    421  assert(inserted);
    +
    422  }
    +
    423 
    +
    424  // Change state and update counts
    +
    425  counts_.remove(*slot);
    +
    426  slot->activate(m_clock.now());
    +
    427  counts_.add(*slot);
    +
    428 
    +
    429  if (!slot->inbound())
    +
    430  bootcache_.on_success(slot->remote_endpoint());
    +
    431 
    +
    432  // Mark fixed slot success
    +
    433  if (slot->fixed() && !slot->inbound())
    +
    434  {
    +
    435  auto iter(fixed_.find(slot->remote_endpoint()));
    +
    436  if (iter == fixed_.end())
    +
    437  LogicError(
    +
    438  "PeerFinder::Logic::activate(): remote_endpoint "
    +
    439  "missing from fixed_");
    +
    440 
    +
    441  iter->second.success(m_clock.now());
    +
    442  JLOG(m_journal.trace()) << beast::leftw(18) << "Logic fixed "
    +
    443  << slot->remote_endpoint() << " success";
    +
    444  }
    445 
    - -
    451  redirect(SlotImp::ptr const& slot)
    -
    452  {
    - -
    454  RedirectHandouts h(slot);
    - -
    456  handout(&h, (&h) + 1, livecache_.hops.begin(), livecache_.hops.end());
    -
    457  return std::move(h.list());
    -
    458  }
    -
    459 
    -
    463  // VFALCO TODO This should add the returned addresses to the
    -
    464  // squelch list in one go once the list is built,
    -
    465  // rather than having each module add to the squelch list.
    - - -
    468  {
    - -
    470 
    - -
    472 
    -
    473  // Count how many more outbound attempts to make
    -
    474  //
    -
    475  auto needed(counts_.attempts_needed());
    -
    476  if (needed == 0)
    -
    477  return none;
    -
    478 
    -
    479  ConnectHandouts h(needed, m_squelches);
    -
    480 
    -
    481  // Make sure we don't connect to already-connected entries.
    -
    482  for (auto const& s : slots_)
    -
    483  {
    -
    484  auto const result(
    -
    485  m_squelches.insert(s.second->remote_endpoint().address()));
    -
    486  if (!result.second)
    -
    487  m_squelches.touch(result.first);
    -
    488  }
    -
    489 
    -
    490  // 1. Use Fixed if:
    -
    491  // Fixed active count is below fixed count AND
    -
    492  // ( There are eligible fixed addresses to try OR
    -
    493  // Any outbound attempts are in progress)
    -
    494  //
    -
    495  if (counts_.fixed_active() < fixed_.size())
    -
    496  {
    -
    497  get_fixed(needed, h.list(), m_squelches);
    -
    498 
    -
    499  if (!h.list().empty())
    -
    500  {
    -
    501  JLOG(m_journal.debug()) << beast::leftw(18) << "Logic connect "
    -
    502  << h.list().size() << " fixed";
    -
    503  return h.list();
    -
    504  }
    -
    505 
    -
    506  if (counts_.attempts() > 0)
    -
    507  {
    -
    508  JLOG(m_journal.debug())
    -
    509  << beast::leftw(18) << "Logic waiting on "
    -
    510  << counts_.attempts() << " attempts";
    -
    511  return none;
    -
    512  }
    -
    513  }
    -
    514 
    -
    515  // Only proceed if auto connect is enabled and we
    -
    516  // have less than the desired number of outbound slots
    -
    517  //
    - -
    519  return none;
    -
    520 
    -
    521  // 2. Use Livecache if:
    -
    522  // There are any entries in the cache OR
    -
    523  // Any outbound attempts are in progress
    -
    524  //
    -
    525  {
    - -
    527  handout(
    -
    528  &h, (&h) + 1, livecache_.hops.rbegin(), livecache_.hops.rend());
    -
    529  if (!h.list().empty())
    -
    530  {
    -
    531  JLOG(m_journal.debug())
    -
    532  << beast::leftw(18) << "Logic connect " << h.list().size()
    -
    533  << " live "
    -
    534  << ((h.list().size() > 1) ? "endpoints" : "endpoint");
    -
    535  return h.list();
    -
    536  }
    -
    537  else if (counts_.attempts() > 0)
    -
    538  {
    -
    539  JLOG(m_journal.debug())
    -
    540  << beast::leftw(18) << "Logic waiting on "
    -
    541  << counts_.attempts() << " attempts";
    -
    542  return none;
    -
    543  }
    -
    544  }
    -
    545 
    -
    546  /* 3. Bootcache refill
    -
    547  If the Bootcache is empty, try to get addresses from the current
    -
    548  set of Sources and add them into the Bootstrap cache.
    -
    549 
    -
    550  Pseudocode:
    -
    551  If ( domainNames.count() > 0 AND (
    -
    552  unusedBootstrapIPs.count() == 0
    -
    553  OR activeNameResolutions.count() > 0) )
    -
    554  ForOneOrMore (DomainName that hasn't been resolved recently)
    -
    555  Contact DomainName and add entries to the
    -
    556  unusedBootstrapIPs return;
    -
    557  */
    -
    558 
    -
    559  // 4. Use Bootcache if:
    -
    560  // There are any entries we haven't tried lately
    -
    561  //
    -
    562  for (auto iter(bootcache_.begin());
    -
    563  !h.full() && iter != bootcache_.end();
    -
    564  ++iter)
    -
    565  h.try_insert(*iter);
    -
    566 
    -
    567  if (!h.list().empty())
    -
    568  {
    -
    569  JLOG(m_journal.debug())
    -
    570  << beast::leftw(18) << "Logic connect " << h.list().size()
    -
    571  << " boot "
    -
    572  << ((h.list().size() > 1) ? "addresses" : "address");
    -
    573  return h.list();
    -
    574  }
    -
    575 
    -
    576  // If we get here we are stuck
    -
    577  return none;
    -
    578  }
    -
    579 
    - - -
    582  {
    - -
    584  result;
    -
    585 
    - -
    587 
    -
    588  clock_type::time_point const now = m_clock.now();
    -
    589  if (m_whenBroadcast <= now)
    -
    590  {
    - -
    592 
    -
    593  {
    -
    594  // build list of active slots
    - -
    596  slots.reserve(slots_.size());
    - -
    598  slots_.cbegin(),
    -
    599  slots_.cend(),
    -
    600  [&slots](Slots::value_type const& value) {
    -
    601  if (value.second->state() == Slot::active)
    -
    602  slots.emplace_back(value.second);
    -
    603  });
    -
    604  std::shuffle(slots.begin(), slots.end(), default_prng());
    -
    605 
    -
    606  // build target vector
    -
    607  targets.reserve(slots.size());
    - -
    609  slots.cbegin(),
    -
    610  slots.cend(),
    -
    611  [&targets](SlotImp::ptr const& slot) {
    -
    612  targets.emplace_back(slot);
    -
    613  });
    -
    614  }
    -
    615 
    -
    616  /* VFALCO NOTE
    -
    617  This is a temporary measure. Once we know our own IP
    -
    618  address, the correct solution is to put it into the Livecache
    -
    619  at hops 0, and go through the regular handout path. This way
    -
    620  we avoid handing our address out too frequenty, which this code
    -
    621  suffers from.
    -
    622  */
    -
    623  // Add an entry for ourselves if:
    -
    624  // 1. We want incoming
    -
    625  // 2. We have slots
    -
    626  // 3. We haven't failed the firewalled test
    -
    627  //
    - -
    629  {
    -
    630  Endpoint ep;
    -
    631  ep.hops = 0;
    -
    632  // we use the unspecified (0) address here because the value is
    -
    633  // irrelevant to recipients. When peers receive an endpoint
    -
    634  // with 0 hops, they use the socket remote_addr instead of the
    -
    635  // value in the message. Furthermore, since the address value
    -
    636  // is ignored, the type/version (ipv4 vs ipv6) doesn't matter
    -
    637  // either. ipv6 has a slightly more compact string
    -
    638  // representation of 0, so use that for self entries.
    - - -
    641  for (auto& t : targets)
    -
    642  t.insert(ep);
    -
    643  }
    -
    644 
    -
    645  // build sequence of endpoints by hops
    - -
    647  handout(
    -
    648  targets.begin(),
    -
    649  targets.end(),
    - -
    651  livecache_.hops.end());
    -
    652 
    -
    653  // broadcast
    -
    654  for (auto const& t : targets)
    -
    655  {
    -
    656  SlotImp::ptr const& slot = t.slot();
    -
    657  auto const& list = t.list();
    -
    658  JLOG(m_journal.trace())
    -
    659  << beast::leftw(18) << "Logic sending "
    -
    660  << slot->remote_endpoint() << " with " << list.size()
    -
    661  << ((list.size() == 1) ? " endpoint" : " endpoints");
    -
    662  result.push_back(std::make_pair(slot, list));
    -
    663  }
    -
    664 
    - -
    666  }
    +
    446  return Result::success;
    +
    447  }
    +
    448 
    + +
    454  redirect(SlotImp::ptr const& slot)
    +
    455  {
    + +
    457  RedirectHandouts h(slot);
    + +
    459  handout(&h, (&h) + 1, livecache_.hops.begin(), livecache_.hops.end());
    +
    460  return std::move(h.list());
    +
    461  }
    +
    462 
    +
    466  // VFALCO TODO This should add the returned addresses to the
    +
    467  // squelch list in one go once the list is built,
    +
    468  // rather than having each module add to the squelch list.
    + + +
    471  {
    + +
    473 
    + +
    475 
    +
    476  // Count how many more outbound attempts to make
    +
    477  //
    +
    478  auto needed(counts_.attempts_needed());
    +
    479  if (needed == 0)
    +
    480  return none;
    +
    481 
    +
    482  ConnectHandouts h(needed, m_squelches);
    +
    483 
    +
    484  // Make sure we don't connect to already-connected entries.
    +
    485  for (auto const& s : slots_)
    +
    486  {
    +
    487  auto const result(
    +
    488  m_squelches.insert(s.second->remote_endpoint().address()));
    +
    489  if (!result.second)
    +
    490  m_squelches.touch(result.first);
    +
    491  }
    +
    492 
    +
    493  // 1. Use Fixed if:
    +
    494  // Fixed active count is below fixed count AND
    +
    495  // ( There are eligible fixed addresses to try OR
    +
    496  // Any outbound attempts are in progress)
    +
    497  //
    +
    498  if (counts_.fixed_active() < fixed_.size())
    +
    499  {
    +
    500  get_fixed(needed, h.list(), m_squelches);
    +
    501 
    +
    502  if (!h.list().empty())
    +
    503  {
    +
    504  JLOG(m_journal.debug()) << beast::leftw(18) << "Logic connect "
    +
    505  << h.list().size() << " fixed";
    +
    506  return h.list();
    +
    507  }
    +
    508 
    +
    509  if (counts_.attempts() > 0)
    +
    510  {
    +
    511  JLOG(m_journal.debug())
    +
    512  << beast::leftw(18) << "Logic waiting on "
    +
    513  << counts_.attempts() << " attempts";
    +
    514  return none;
    +
    515  }
    +
    516  }
    +
    517 
    +
    518  // Only proceed if auto connect is enabled and we
    +
    519  // have less than the desired number of outbound slots
    +
    520  //
    + +
    522  return none;
    +
    523 
    +
    524  // 2. Use Livecache if:
    +
    525  // There are any entries in the cache OR
    +
    526  // Any outbound attempts are in progress
    +
    527  //
    +
    528  {
    + +
    530  handout(
    +
    531  &h, (&h) + 1, livecache_.hops.rbegin(), livecache_.hops.rend());
    +
    532  if (!h.list().empty())
    +
    533  {
    +
    534  JLOG(m_journal.debug())
    +
    535  << beast::leftw(18) << "Logic connect " << h.list().size()
    +
    536  << " live "
    +
    537  << ((h.list().size() > 1) ? "endpoints" : "endpoint");
    +
    538  return h.list();
    +
    539  }
    +
    540  else if (counts_.attempts() > 0)
    +
    541  {
    +
    542  JLOG(m_journal.debug())
    +
    543  << beast::leftw(18) << "Logic waiting on "
    +
    544  << counts_.attempts() << " attempts";
    +
    545  return none;
    +
    546  }
    +
    547  }
    +
    548 
    +
    549  /* 3. Bootcache refill
    +
    550  If the Bootcache is empty, try to get addresses from the current
    +
    551  set of Sources and add them into the Bootstrap cache.
    +
    552 
    +
    553  Pseudocode:
    +
    554  If ( domainNames.count() > 0 AND (
    +
    555  unusedBootstrapIPs.count() == 0
    +
    556  OR activeNameResolutions.count() > 0) )
    +
    557  ForOneOrMore (DomainName that hasn't been resolved recently)
    +
    558  Contact DomainName and add entries to the
    +
    559  unusedBootstrapIPs return;
    +
    560  */
    +
    561 
    +
    562  // 4. Use Bootcache if:
    +
    563  // There are any entries we haven't tried lately
    +
    564  //
    +
    565  for (auto iter(bootcache_.begin());
    +
    566  !h.full() && iter != bootcache_.end();
    +
    567  ++iter)
    +
    568  h.try_insert(*iter);
    +
    569 
    +
    570  if (!h.list().empty())
    +
    571  {
    +
    572  JLOG(m_journal.debug())
    +
    573  << beast::leftw(18) << "Logic connect " << h.list().size()
    +
    574  << " boot "
    +
    575  << ((h.list().size() > 1) ? "addresses" : "address");
    +
    576  return h.list();
    +
    577  }
    +
    578 
    +
    579  // If we get here we are stuck
    +
    580  return none;
    +
    581  }
    +
    582 
    + + +
    585  {
    + +
    587  result;
    +
    588 
    + +
    590 
    +
    591  clock_type::time_point const now = m_clock.now();
    +
    592  if (m_whenBroadcast <= now)
    +
    593  {
    + +
    595 
    +
    596  {
    +
    597  // build list of active slots
    + +
    599  slots.reserve(slots_.size());
    + +
    601  slots_.cbegin(),
    +
    602  slots_.cend(),
    +
    603  [&slots](Slots::value_type const& value) {
    +
    604  if (value.second->state() == Slot::active)
    +
    605  slots.emplace_back(value.second);
    +
    606  });
    +
    607  std::shuffle(slots.begin(), slots.end(), default_prng());
    +
    608 
    +
    609  // build target vector
    +
    610  targets.reserve(slots.size());
    + +
    612  slots.cbegin(),
    +
    613  slots.cend(),
    +
    614  [&targets](SlotImp::ptr const& slot) {
    +
    615  targets.emplace_back(slot);
    +
    616  });
    +
    617  }
    +
    618 
    +
    619  /* VFALCO NOTE
    +
    620  This is a temporary measure. Once we know our own IP
    +
    621  address, the correct solution is to put it into the Livecache
    +
    622  at hops 0, and go through the regular handout path. This way
    +
    623  we avoid handing our address out too frequenty, which this code
    +
    624  suffers from.
    +
    625  */
    +
    626  // Add an entry for ourselves if:
    +
    627  // 1. We want incoming
    +
    628  // 2. We have slots
    +
    629  // 3. We haven't failed the firewalled test
    +
    630  //
    + +
    632  {
    +
    633  Endpoint ep;
    +
    634  ep.hops = 0;
    +
    635  // we use the unspecified (0) address here because the value is
    +
    636  // irrelevant to recipients. When peers receive an endpoint
    +
    637  // with 0 hops, they use the socket remote_addr instead of the
    +
    638  // value in the message. Furthermore, since the address value
    +
    639  // is ignored, the type/version (ipv4 vs ipv6) doesn't matter
    +
    640  // either. ipv6 has a slightly more compact string
    +
    641  // representation of 0, so use that for self entries.
    + + +
    644  for (auto& t : targets)
    +
    645  t.insert(ep);
    +
    646  }
    +
    647 
    +
    648  // build sequence of endpoints by hops
    + +
    650  handout(
    +
    651  targets.begin(),
    +
    652  targets.end(),
    + +
    654  livecache_.hops.end());
    +
    655 
    +
    656  // broadcast
    +
    657  for (auto const& t : targets)
    +
    658  {
    +
    659  SlotImp::ptr const& slot = t.slot();
    +
    660  auto const& list = t.list();
    +
    661  JLOG(m_journal.trace())
    +
    662  << beast::leftw(18) << "Logic sending "
    +
    663  << slot->remote_endpoint() << " with " << list.size()
    +
    664  << ((list.size() == 1) ? " endpoint" : " endpoints");
    +
    665  result.push_back(std::make_pair(slot, list));
    +
    666  }
    667 
    -
    668  return result;
    -
    669  }
    + +
    669  }
    670 
    -
    671  void
    - -
    673  {
    - -
    675 
    -
    676  // Expire the Livecache
    -
    677  livecache_.expire();
    +
    671  return result;
    +
    672  }
    +
    673 
    +
    674  void
    + +
    676  {
    +
    678 
    -
    679  // Expire the recent cache in each slot
    -
    680  for (auto const& entry : slots_)
    -
    681  entry.second->expire();
    -
    682 
    -
    683  // Expire the recent attempts table
    - +
    679  // Expire the Livecache
    +
    680  livecache_.expire();
    +
    681 
    +
    682  // Expire the recent cache in each slot
    +
    683  for (auto const& entry : slots_)
    +
    684  entry.second->expire();
    685 
    - -
    687  }
    +
    686  // Expire the recent attempts table
    +
    688 
    -
    689  //--------------------------------------------------------------------------
    -
    690 
    -
    691  // Validate and clean up the list that we received from the slot.
    -
    692  void
    -
    693  preprocess(SlotImp::ptr const& slot, Endpoints& list)
    -
    694  {
    -
    695  bool neighbor(false);
    -
    696  for (auto iter = list.begin(); iter != list.end();)
    -
    697  {
    -
    698  Endpoint& ep(*iter);
    -
    699 
    -
    700  // Enforce hop limit
    -
    701  if (ep.hops > Tuning::maxHops)
    -
    702  {
    -
    703  JLOG(m_journal.debug())
    -
    704  << beast::leftw(18) << "Endpoints drop " << ep.address
    -
    705  << " for excess hops " << ep.hops;
    -
    706  iter = list.erase(iter);
    -
    707  continue;
    -
    708  }
    -
    709 
    -
    710  // See if we are directly connected
    -
    711  if (ep.hops == 0)
    -
    712  {
    -
    713  if (!neighbor)
    -
    714  {
    -
    715  // Fill in our neighbors remote address
    -
    716  neighbor = true;
    -
    717  ep.address =
    -
    718  slot->remote_endpoint().at_port(ep.address.port());
    -
    719  }
    -
    720  else
    -
    721  {
    -
    722  JLOG(m_journal.debug())
    -
    723  << beast::leftw(18) << "Endpoints drop " << ep.address
    -
    724  << " for extra self";
    -
    725  iter = list.erase(iter);
    -
    726  continue;
    -
    727  }
    -
    728  }
    -
    729 
    -
    730  // Discard invalid addresses
    -
    731  if (!is_valid_address(ep.address))
    -
    732  {
    -
    733  JLOG(m_journal.debug()) << beast::leftw(18) << "Endpoints drop "
    -
    734  << ep.address << " as invalid";
    -
    735  iter = list.erase(iter);
    -
    736  continue;
    -
    737  }
    -
    738 
    -
    739  // Filter duplicates
    -
    740  if (std::any_of(
    -
    741  list.begin(),
    -
    742  iter,
    -
    743  [ep](Endpoints::value_type const& other) {
    -
    744  return ep.address == other.address;
    -
    745  }))
    -
    746  {
    -
    747  JLOG(m_journal.debug()) << beast::leftw(18) << "Endpoints drop "
    -
    748  << ep.address << " as duplicate";
    -
    749  iter = list.erase(iter);
    -
    750  continue;
    -
    751  }
    -
    752 
    -
    753  // Increment hop count on the incoming message, so
    -
    754  // we store it at the hop count we will send it at.
    -
    755  //
    -
    756  ++ep.hops;
    -
    757 
    -
    758  ++iter;
    -
    759  }
    -
    760  }
    -
    761 
    -
    762  void
    - -
    764  {
    -
    765  // If we're sent too many endpoints, sample them at random:
    -
    766  if (list.size() > Tuning::numberOfEndpointsMax)
    -
    767  {
    -
    768  std::shuffle(list.begin(), list.end(), default_prng());
    - -
    770  }
    -
    771 
    -
    772  JLOG(m_journal.trace())
    -
    773  << beast::leftw(18) << "Endpoints from " << slot->remote_endpoint()
    -
    774  << " contained " << list.size()
    -
    775  << ((list.size() > 1) ? " entries" : " entry");
    -
    776 
    - -
    778 
    -
    779  // The object must exist in our table
    -
    780  assert(slots_.find(slot->remote_endpoint()) != slots_.end());
    + +
    690  }
    +
    691 
    +
    692  //--------------------------------------------------------------------------
    +
    693 
    +
    694  // Validate and clean up the list that we received from the slot.
    +
    695  void
    +
    696  preprocess(SlotImp::ptr const& slot, Endpoints& list)
    +
    697  {
    +
    698  bool neighbor(false);
    +
    699  for (auto iter = list.begin(); iter != list.end();)
    +
    700  {
    +
    701  Endpoint& ep(*iter);
    +
    702 
    +
    703  // Enforce hop limit
    +
    704  if (ep.hops > Tuning::maxHops)
    +
    705  {
    +
    706  JLOG(m_journal.debug())
    +
    707  << beast::leftw(18) << "Endpoints drop " << ep.address
    +
    708  << " for excess hops " << ep.hops;
    +
    709  iter = list.erase(iter);
    +
    710  continue;
    +
    711  }
    +
    712 
    +
    713  // See if we are directly connected
    +
    714  if (ep.hops == 0)
    +
    715  {
    +
    716  if (!neighbor)
    +
    717  {
    +
    718  // Fill in our neighbors remote address
    +
    719  neighbor = true;
    +
    720  ep.address =
    +
    721  slot->remote_endpoint().at_port(ep.address.port());
    +
    722  }
    +
    723  else
    +
    724  {
    +
    725  JLOG(m_journal.debug())
    +
    726  << beast::leftw(18) << "Endpoints drop " << ep.address
    +
    727  << " for extra self";
    +
    728  iter = list.erase(iter);
    +
    729  continue;
    +
    730  }
    +
    731  }
    +
    732 
    +
    733  // Discard invalid addresses
    +
    734  if (!is_valid_address(ep.address))
    +
    735  {
    +
    736  JLOG(m_journal.debug()) << beast::leftw(18) << "Endpoints drop "
    +
    737  << ep.address << " as invalid";
    +
    738  iter = list.erase(iter);
    +
    739  continue;
    +
    740  }
    +
    741 
    +
    742  // Filter duplicates
    +
    743  if (std::any_of(
    +
    744  list.begin(),
    +
    745  iter,
    +
    746  [ep](Endpoints::value_type const& other) {
    +
    747  return ep.address == other.address;
    +
    748  }))
    +
    749  {
    +
    750  JLOG(m_journal.debug()) << beast::leftw(18) << "Endpoints drop "
    +
    751  << ep.address << " as duplicate";
    +
    752  iter = list.erase(iter);
    +
    753  continue;
    +
    754  }
    +
    755 
    +
    756  // Increment hop count on the incoming message, so
    +
    757  // we store it at the hop count we will send it at.
    +
    758  //
    +
    759  ++ep.hops;
    +
    760 
    +
    761  ++iter;
    +
    762  }
    +
    763  }
    +
    764 
    +
    765  void
    + +
    767  {
    +
    768  // If we're sent too many endpoints, sample them at random:
    +
    769  if (list.size() > Tuning::numberOfEndpointsMax)
    +
    770  {
    +
    771  std::shuffle(list.begin(), list.end(), default_prng());
    + +
    773  }
    +
    774 
    +
    775  JLOG(m_journal.trace())
    +
    776  << beast::leftw(18) << "Endpoints from " << slot->remote_endpoint()
    +
    777  << " contained " << list.size()
    +
    778  << ((list.size() > 1) ? " entries" : " entry");
    +
    779 
    +
    781 
    -
    782  // Must be handshaked!
    -
    783  assert(slot->state() == Slot::active);
    +
    782  // The object must exist in our table
    +
    783  assert(slots_.find(slot->remote_endpoint()) != slots_.end());
    784 
    -
    785  clock_type::time_point const now(m_clock.now());
    -
    786 
    -
    787  // Limit how often we accept new endpoints
    -
    788  if (slot->whenAcceptEndpoints > now)
    -
    789  return;
    -
    790 
    -
    791  preprocess(slot, list);
    -
    792 
    -
    793  for (auto const& ep : list)
    -
    794  {
    -
    795  assert(ep.hops != 0);
    -
    796 
    -
    797  slot->recent.insert(ep.address, ep.hops);
    -
    798 
    -
    799  // Note hops has been incremented, so 1
    -
    800  // means a directly connected neighbor.
    -
    801  //
    -
    802  if (ep.hops == 1)
    -
    803  {
    -
    804  if (slot->connectivityCheckInProgress)
    -
    805  {
    -
    806  JLOG(m_journal.debug())
    -
    807  << beast::leftw(18) << "Logic testing " << ep.address
    -
    808  << " already in progress";
    -
    809  continue;
    -
    810  }
    -
    811 
    -
    812  if (!slot->checked)
    -
    813  {
    -
    814  // Mark that a check for this slot is now in progress.
    -
    815  slot->connectivityCheckInProgress = true;
    -
    816 
    -
    817  // Test the slot's listening port before
    -
    818  // adding it to the livecache for the first time.
    -
    819  //
    - -
    821  ep.address,
    -
    822  std::bind(
    - -
    824  this,
    -
    825  slot->remote_endpoint(),
    -
    826  ep.address,
    -
    827  std::placeholders::_1));
    -
    828 
    -
    829  // Note that we simply discard the first Endpoint
    -
    830  // that the neighbor sends when we perform the
    -
    831  // listening test. They will just send us another
    -
    832  // one in a few seconds.
    -
    833 
    -
    834  continue;
    -
    835  }
    +
    785  // Must be handshaked!
    +
    786  assert(slot->state() == Slot::active);
    +
    787 
    +
    788  clock_type::time_point const now(m_clock.now());
    +
    789 
    +
    790  // Limit how often we accept new endpoints
    +
    791  if (slot->whenAcceptEndpoints > now)
    +
    792  return;
    +
    793 
    +
    794  preprocess(slot, list);
    +
    795 
    +
    796  for (auto const& ep : list)
    +
    797  {
    +
    798  assert(ep.hops != 0);
    +
    799 
    +
    800  slot->recent.insert(ep.address, ep.hops);
    +
    801 
    +
    802  // Note hops has been incremented, so 1
    +
    803  // means a directly connected neighbor.
    +
    804  //
    +
    805  if (ep.hops == 1)
    +
    806  {
    +
    807  if (slot->connectivityCheckInProgress)
    +
    808  {
    +
    809  JLOG(m_journal.debug())
    +
    810  << beast::leftw(18) << "Logic testing " << ep.address
    +
    811  << " already in progress";
    +
    812  continue;
    +
    813  }
    +
    814 
    +
    815  if (!slot->checked)
    +
    816  {
    +
    817  // Mark that a check for this slot is now in progress.
    +
    818  slot->connectivityCheckInProgress = true;
    +
    819 
    +
    820  // Test the slot's listening port before
    +
    821  // adding it to the livecache for the first time.
    +
    822  //
    + +
    824  ep.address,
    +
    825  std::bind(
    + +
    827  this,
    +
    828  slot->remote_endpoint(),
    +
    829  ep.address,
    +
    830  std::placeholders::_1));
    +
    831 
    +
    832  // Note that we simply discard the first Endpoint
    +
    833  // that the neighbor sends when we perform the
    +
    834  // listening test. They will just send us another
    +
    835  // one in a few seconds.
    836 
    -
    837  // If they failed the test then skip the address
    -
    838  if (!slot->canAccept)
    -
    839  continue;
    -
    840  }
    -
    841 
    -
    842  // We only add to the livecache if the neighbor passed the
    -
    843  // listening test, else we silently drop neighbor endpoint
    -
    844  // since their listening port is misconfigured.
    -
    845  //
    -
    846  livecache_.insert(ep);
    -
    847  bootcache_.insert(ep.address);
    -
    848  }
    -
    849 
    -
    850  slot->whenAcceptEndpoints = now + Tuning::secondsPerMessage;
    -
    851  }
    +
    837  continue;
    +
    838  }
    +
    839 
    +
    840  // If they failed the test then skip the address
    +
    841  if (!slot->canAccept)
    +
    842  continue;
    +
    843  }
    +
    844 
    +
    845  // We only add to the livecache if the neighbor passed the
    +
    846  // listening test, else we silently drop neighbor endpoint
    +
    847  // since their listening port is misconfigured.
    +
    848  //
    +
    849  livecache_.insert(ep);
    +
    850  bootcache_.insert(ep.address);
    +
    851  }
    852 
    -
    853  //--------------------------------------------------------------------------
    -
    854 
    -
    855  void
    -
    856  remove(SlotImp::ptr const& slot)
    -
    857  {
    -
    858  {
    -
    859  auto const iter = slots_.find(slot->remote_endpoint());
    -
    860  // The slot must exist in the table
    -
    861  assert(iter != slots_.end());
    -
    862  // Remove from slot by IP table
    -
    863  slots_.erase(iter);
    -
    864  }
    -
    865  // Remove the key if present
    -
    866  if (slot->public_key() != std::nullopt)
    -
    867  {
    -
    868  auto const iter = keys_.find(*slot->public_key());
    -
    869  // Key must exist
    -
    870  assert(iter != keys_.end());
    -
    871  keys_.erase(iter);
    -
    872  }
    -
    873  // Remove from connected address table
    +
    853  slot->whenAcceptEndpoints = now + Tuning::secondsPerMessage;
    +
    854  }
    +
    855 
    +
    856  //--------------------------------------------------------------------------
    +
    857 
    +
    858  void
    +
    859  remove(SlotImp::ptr const& slot)
    +
    860  {
    +
    861  {
    +
    862  auto const iter = slots_.find(slot->remote_endpoint());
    +
    863  // The slot must exist in the table
    +
    864  if (iter == slots_.end())
    +
    865  LogicError(
    +
    866  "PeerFinder::Logic::remove(): remote_endpoint "
    +
    867  "missing from slots_");
    +
    868 
    +
    869  // Remove from slot by IP table
    +
    870  slots_.erase(iter);
    +
    871  }
    +
    872  // Remove the key if present
    +
    873  if (slot->public_key() != std::nullopt)
    874  {
    -
    875  auto const iter(
    -
    876  connectedAddresses_.find(slot->remote_endpoint().address()));
    -
    877  // Address must exist
    -
    878  assert(iter != connectedAddresses_.end());
    - -
    880  }
    +
    875  auto const iter = keys_.find(*slot->public_key());
    +
    876  // Key must exist
    +
    877  if (iter == keys_.end())
    +
    878  LogicError(
    +
    879  "PeerFinder::Logic::remove(): public_key missing "
    +
    880  "from keys_");
    881 
    -
    882  // Update counts
    -
    883  counts_.remove(*slot);
    -
    884  }
    -
    885 
    -
    886  void
    -
    887  on_closed(SlotImp::ptr const& slot)
    -
    888  {
    - -
    890 
    -
    891  remove(slot);
    -
    892 
    -
    893  // Mark fixed slot failure
    -
    894  if (slot->fixed() && !slot->inbound() && slot->state() != Slot::active)
    -
    895  {
    -
    896  auto iter(fixed_.find(slot->remote_endpoint()));
    -
    897  assert(iter != fixed_.end());
    -
    898  iter->second.failure(m_clock.now());
    -
    899  JLOG(m_journal.debug()) << beast::leftw(18) << "Logic fixed "
    -
    900  << slot->remote_endpoint() << " failed";
    -
    901  }
    -
    902 
    -
    903  // Do state specific bookkeeping
    -
    904  switch (slot->state())
    -
    905  {
    -
    906  case Slot::accept:
    -
    907  JLOG(m_journal.trace()) << beast::leftw(18) << "Logic accept "
    -
    908  << slot->remote_endpoint() << " failed";
    -
    909  break;
    -
    910 
    -
    911  case Slot::connect:
    -
    912  case Slot::connected:
    -
    913  bootcache_.on_failure(slot->remote_endpoint());
    -
    914  // VFALCO TODO If the address exists in the ephemeral/live
    -
    915  // endpoint livecache then we should mark the
    -
    916  // failure
    -
    917  // as if it didn't pass the listening test. We should also
    -
    918  // avoid propagating the address.
    -
    919  break;
    -
    920 
    -
    921  case Slot::active:
    -
    922  JLOG(m_journal.trace()) << beast::leftw(18) << "Logic close "
    -
    923  << slot->remote_endpoint();
    -
    924  break;
    -
    925 
    -
    926  case Slot::closing:
    -
    927  JLOG(m_journal.trace()) << beast::leftw(18) << "Logic finished "
    -
    928  << slot->remote_endpoint();
    -
    929  break;
    -
    930 
    -
    931  default:
    -
    932  assert(false);
    -
    933  break;
    -
    934  }
    -
    935  }
    -
    936 
    -
    937  void
    - -
    939  {
    - -
    941 
    -
    942  bootcache_.on_failure(slot->remote_endpoint());
    -
    943  }
    +
    882  keys_.erase(iter);
    +
    883  }
    +
    884  // Remove from connected address table
    +
    885  {
    +
    886  auto const iter(
    +
    887  connectedAddresses_.find(slot->remote_endpoint().address()));
    +
    888  // Address must exist
    +
    889  if (iter == connectedAddresses_.end())
    +
    890  LogicError(
    +
    891  "PeerFinder::Logic::remove(): remote_endpont "
    +
    892  "address missing from connectedAddresses_");
    +
    893 
    + +
    895  }
    +
    896 
    +
    897  // Update counts
    +
    898  counts_.remove(*slot);
    +
    899  }
    +
    900 
    +
    901  void
    +
    902  on_closed(SlotImp::ptr const& slot)
    +
    903  {
    + +
    905 
    +
    906  remove(slot);
    +
    907 
    +
    908  // Mark fixed slot failure
    +
    909  if (slot->fixed() && !slot->inbound() && slot->state() != Slot::active)
    +
    910  {
    +
    911  auto iter(fixed_.find(slot->remote_endpoint()));
    +
    912  if (iter == fixed_.end())
    +
    913  LogicError(
    +
    914  "PeerFinder::Logic::on_closed(): remote_endpont "
    +
    915  "missing from fixed_");
    +
    916 
    +
    917  iter->second.failure(m_clock.now());
    +
    918  JLOG(m_journal.debug()) << beast::leftw(18) << "Logic fixed "
    +
    919  << slot->remote_endpoint() << " failed";
    +
    920  }
    +
    921 
    +
    922  // Do state specific bookkeeping
    +
    923  switch (slot->state())
    +
    924  {
    +
    925  case Slot::accept:
    +
    926  JLOG(m_journal.trace()) << beast::leftw(18) << "Logic accept "
    +
    927  << slot->remote_endpoint() << " failed";
    +
    928  break;
    +
    929 
    +
    930  case Slot::connect:
    +
    931  case Slot::connected:
    +
    932  bootcache_.on_failure(slot->remote_endpoint());
    +
    933  // VFALCO TODO If the address exists in the ephemeral/live
    +
    934  // endpoint livecache then we should mark the
    +
    935  // failure
    +
    936  // as if it didn't pass the listening test. We should also
    +
    937  // avoid propagating the address.
    +
    938  break;
    +
    939 
    +
    940  case Slot::active:
    +
    941  JLOG(m_journal.trace()) << beast::leftw(18) << "Logic close "
    +
    942  << slot->remote_endpoint();
    +
    943  break;
    944 
    -
    945  // Insert a set of redirect IP addresses into the Bootcache
    -
    946  template <class FwdIter>
    -
    947  void
    -
    948  onRedirects(
    -
    949  FwdIter first,
    -
    950  FwdIter last,
    -
    951  boost::asio::ip::tcp::endpoint const& remote_address);
    -
    952 
    -
    953  //--------------------------------------------------------------------------
    -
    954 
    -
    955  // Returns `true` if the address matches a fixed slot address
    -
    956  // Must have the lock held
    -
    957  bool
    -
    958  fixed(beast::IP::Endpoint const& endpoint) const
    -
    959  {
    -
    960  for (auto const& entry : fixed_)
    -
    961  if (entry.first == endpoint)
    -
    962  return true;
    -
    963  return false;
    -
    964  }
    -
    965 
    -
    966  // Returns `true` if the address matches a fixed slot address
    -
    967  // Note that this does not use the port information in the IP::Endpoint
    -
    968  // Must have the lock held
    -
    969  bool
    -
    970  fixed(beast::IP::Address const& address) const
    -
    971  {
    -
    972  for (auto const& entry : fixed_)
    -
    973  if (entry.first.address() == address)
    -
    974  return true;
    -
    975  return false;
    -
    976  }
    -
    977 
    -
    978  //--------------------------------------------------------------------------
    -
    979  //
    -
    980  // Connection Strategy
    -
    981  //
    -
    982  //--------------------------------------------------------------------------
    -
    983 
    -
    985  template <class Container>
    -
    986  void
    - -
    988  std::size_t needed,
    -
    989  Container& c,
    -
    990  typename ConnectHandouts::Squelches& squelches)
    -
    991  {
    -
    992  auto const now(m_clock.now());
    -
    993  for (auto iter = fixed_.begin(); needed && iter != fixed_.end(); ++iter)
    -
    994  {
    -
    995  auto const& address(iter->first.address());
    -
    996  if (iter->second.when() <= now &&
    -
    997  squelches.find(address) == squelches.end() &&
    -
    998  std::none_of(
    -
    999  slots_.cbegin(),
    -
    1000  slots_.cend(),
    -
    1001  [address](Slots::value_type const& v) {
    -
    1002  return address == v.first.address();
    -
    1003  }))
    -
    1004  {
    -
    1005  squelches.insert(iter->first.address());
    -
    1006  c.push_back(iter->first);
    -
    1007  --needed;
    -
    1008  }
    -
    1009  }
    -
    1010  }
    -
    1011 
    -
    1012  //--------------------------------------------------------------------------
    -
    1013 
    -
    1014  void
    - -
    1016  {
    -
    1017  fetch(source);
    -
    1018  }
    -
    1019 
    -
    1020  void
    - -
    1022  {
    -
    1023  m_sources.push_back(source);
    -
    1024  }
    -
    1025 
    -
    1026  //--------------------------------------------------------------------------
    -
    1027  //
    -
    1028  // Bootcache livecache sources
    -
    1029  //
    -
    1030  //--------------------------------------------------------------------------
    -
    1031 
    -
    1032  // Add a set of addresses.
    -
    1033  // Returns the number of addresses added.
    -
    1034  //
    -
    1035  int
    - -
    1037  {
    -
    1038  int count(0);
    - -
    1040  for (auto addr : list)
    -
    1041  {
    -
    1042  if (bootcache_.insertStatic(addr))
    -
    1043  ++count;
    -
    1044  }
    -
    1045  return count;
    -
    1046  }
    -
    1047 
    -
    1048  // Fetch bootcache addresses from the specified source.
    -
    1049  void
    - -
    1051  {
    -
    1052  Source::Results results;
    -
    1053 
    -
    1054  {
    -
    1055  {
    - -
    1057  if (stopping_)
    -
    1058  return;
    -
    1059  fetchSource_ = source;
    -
    1060  }
    -
    1061 
    -
    1062  // VFALCO NOTE The fetch is synchronous,
    -
    1063  // not sure if that's a good thing.
    -
    1064  //
    -
    1065  source->fetch(results, m_journal);
    +
    945  case Slot::closing:
    +
    946  JLOG(m_journal.trace()) << beast::leftw(18) << "Logic finished "
    +
    947  << slot->remote_endpoint();
    +
    948  break;
    +
    949 
    +
    950  default:
    +
    951  assert(false);
    +
    952  break;
    +
    953  }
    +
    954  }
    +
    955 
    +
    956  void
    + +
    958  {
    + +
    960 
    +
    961  bootcache_.on_failure(slot->remote_endpoint());
    +
    962  }
    +
    963 
    +
    964  // Insert a set of redirect IP addresses into the Bootcache
    +
    965  template <class FwdIter>
    +
    966  void
    +
    967  onRedirects(
    +
    968  FwdIter first,
    +
    969  FwdIter last,
    +
    970  boost::asio::ip::tcp::endpoint const& remote_address);
    +
    971 
    +
    972  //--------------------------------------------------------------------------
    +
    973 
    +
    974  // Returns `true` if the address matches a fixed slot address
    +
    975  // Must have the lock held
    +
    976  bool
    +
    977  fixed(beast::IP::Endpoint const& endpoint) const
    +
    978  {
    +
    979  for (auto const& entry : fixed_)
    +
    980  if (entry.first == endpoint)
    +
    981  return true;
    +
    982  return false;
    +
    983  }
    +
    984 
    +
    985  // Returns `true` if the address matches a fixed slot address
    +
    986  // Note that this does not use the port information in the IP::Endpoint
    +
    987  // Must have the lock held
    +
    988  bool
    +
    989  fixed(beast::IP::Address const& address) const
    +
    990  {
    +
    991  for (auto const& entry : fixed_)
    +
    992  if (entry.first.address() == address)
    +
    993  return true;
    +
    994  return false;
    +
    995  }
    +
    996 
    +
    997  //--------------------------------------------------------------------------
    +
    998  //
    +
    999  // Connection Strategy
    +
    1000  //
    +
    1001  //--------------------------------------------------------------------------
    +
    1002 
    +
    1004  template <class Container>
    +
    1005  void
    + +
    1007  std::size_t needed,
    +
    1008  Container& c,
    +
    1009  typename ConnectHandouts::Squelches& squelches)
    +
    1010  {
    +
    1011  auto const now(m_clock.now());
    +
    1012  for (auto iter = fixed_.begin(); needed && iter != fixed_.end(); ++iter)
    +
    1013  {
    +
    1014  auto const& address(iter->first.address());
    +
    1015  if (iter->second.when() <= now &&
    +
    1016  squelches.find(address) == squelches.end() &&
    +
    1017  std::none_of(
    +
    1018  slots_.cbegin(),
    +
    1019  slots_.cend(),
    +
    1020  [address](Slots::value_type const& v) {
    +
    1021  return address == v.first.address();
    +
    1022  }))
    +
    1023  {
    +
    1024  squelches.insert(iter->first.address());
    +
    1025  c.push_back(iter->first);
    +
    1026  --needed;
    +
    1027  }
    +
    1028  }
    +
    1029  }
    +
    1030 
    +
    1031  //--------------------------------------------------------------------------
    +
    1032 
    +
    1033  void
    + +
    1035  {
    +
    1036  fetch(source);
    +
    1037  }
    +
    1038 
    +
    1039  void
    + +
    1041  {
    +
    1042  m_sources.push_back(source);
    +
    1043  }
    +
    1044 
    +
    1045  //--------------------------------------------------------------------------
    +
    1046  //
    +
    1047  // Bootcache livecache sources
    +
    1048  //
    +
    1049  //--------------------------------------------------------------------------
    +
    1050 
    +
    1051  // Add a set of addresses.
    +
    1052  // Returns the number of addresses added.
    +
    1053  //
    +
    1054  int
    + +
    1056  {
    +
    1057  int count(0);
    + +
    1059  for (auto addr : list)
    +
    1060  {
    +
    1061  if (bootcache_.insertStatic(addr))
    +
    1062  ++count;
    +
    1063  }
    +
    1064  return count;
    +
    1065  }
    1066 
    -
    1067  {
    - -
    1069  if (stopping_)
    -
    1070  return;
    -
    1071  fetchSource_ = nullptr;
    -
    1072  }
    -
    1073  }
    -
    1074 
    -
    1075  if (!results.error)
    -
    1076  {
    -
    1077  int const count(addBootcacheAddresses(results.addresses));
    -
    1078  JLOG(m_journal.info())
    -
    1079  << beast::leftw(18) << "Logic added " << count << " new "
    -
    1080  << ((count == 1) ? "address" : "addresses") << " from "
    -
    1081  << source->name();
    -
    1082  }
    -
    1083  else
    -
    1084  {
    -
    1085  JLOG(m_journal.error()) << beast::leftw(18) << "Logic failed "
    -
    1086  << "'" << source->name() << "' fetch, "
    -
    1087  << results.error.message();
    -
    1088  }
    -
    1089  }
    -
    1090 
    -
    1091  //--------------------------------------------------------------------------
    -
    1092  //
    -
    1093  // Endpoint message handling
    -
    1094  //
    -
    1095  //--------------------------------------------------------------------------
    -
    1096 
    -
    1097  // Returns true if the IP::Endpoint contains no invalid data.
    -
    1098  bool
    - -
    1100  {
    -
    1101  if (is_unspecified(address))
    -
    1102  return false;
    -
    1103  if (!is_public(address))
    -
    1104  return false;
    -
    1105  if (address.port() == 0)
    -
    1106  return false;
    -
    1107  return true;
    +
    1067  // Fetch bootcache addresses from the specified source.
    +
    1068  void
    + +
    1070  {
    +
    1071  Source::Results results;
    +
    1072 
    +
    1073  {
    +
    1074  {
    + +
    1076  if (stopping_)
    +
    1077  return;
    +
    1078  fetchSource_ = source;
    +
    1079  }
    +
    1080 
    +
    1081  // VFALCO NOTE The fetch is synchronous,
    +
    1082  // not sure if that's a good thing.
    +
    1083  //
    +
    1084  source->fetch(results, m_journal);
    +
    1085 
    +
    1086  {
    + +
    1088  if (stopping_)
    +
    1089  return;
    +
    1090  fetchSource_ = nullptr;
    +
    1091  }
    +
    1092  }
    +
    1093 
    +
    1094  if (!results.error)
    +
    1095  {
    +
    1096  int const count(addBootcacheAddresses(results.addresses));
    +
    1097  JLOG(m_journal.info())
    +
    1098  << beast::leftw(18) << "Logic added " << count << " new "
    +
    1099  << ((count == 1) ? "address" : "addresses") << " from "
    +
    1100  << source->name();
    +
    1101  }
    +
    1102  else
    +
    1103  {
    +
    1104  JLOG(m_journal.error()) << beast::leftw(18) << "Logic failed "
    +
    1105  << "'" << source->name() << "' fetch, "
    +
    1106  << results.error.message();
    +
    1107  }
    1108  }
    1109 
    1110  //--------------------------------------------------------------------------
    1111  //
    -
    1112  // PropertyStream
    +
    1112  // Endpoint message handling
    1113  //
    1114  //--------------------------------------------------------------------------
    1115 
    -
    1116  void
    - -
    1118  {
    -
    1119  for (auto const& entry : slots)
    -
    1120  {
    - -
    1122  SlotImp const& slot(*entry.second);
    -
    1123  if (slot.local_endpoint() != std::nullopt)
    -
    1124  item["local_address"] = to_string(*slot.local_endpoint());
    -
    1125  item["remote_address"] = to_string(slot.remote_endpoint());
    -
    1126  if (slot.inbound())
    -
    1127  item["inbound"] = "yes";
    -
    1128  if (slot.fixed())
    -
    1129  item["fixed"] = "yes";
    -
    1130  if (slot.reserved())
    -
    1131  item["reserved"] = "yes";
    -
    1132 
    -
    1133  item["state"] = stateString(slot.state());
    -
    1134  }
    -
    1135  }
    -
    1136 
    -
    1137  void
    - -
    1139  {
    - -
    1141 
    -
    1142  // VFALCO NOTE These ugly casts are needed because
    -
    1143  // of how std::size_t is declared on some linuxes
    -
    1144  //
    -
    1145  map["bootcache"] = std::uint32_t(bootcache_.size());
    -
    1146  map["fixed"] = std::uint32_t(fixed_.size());
    -
    1147 
    -
    1148  {
    -
    1149  beast::PropertyStream::Set child("peers", map);
    -
    1150  writeSlots(child, slots_);
    -
    1151  }
    -
    1152 
    -
    1153  {
    -
    1154  beast::PropertyStream::Map child("counts", map);
    -
    1155  counts_.onWrite(child);
    -
    1156  }
    -
    1157 
    -
    1158  {
    -
    1159  beast::PropertyStream::Map child("config", map);
    -
    1160  config_.onWrite(child);
    -
    1161  }
    -
    1162 
    -
    1163  {
    -
    1164  beast::PropertyStream::Map child("livecache", map);
    -
    1165  livecache_.onWrite(child);
    -
    1166  }
    -
    1167 
    -
    1168  {
    -
    1169  beast::PropertyStream::Map child("bootcache", map);
    -
    1170  bootcache_.onWrite(child);
    -
    1171  }
    -
    1172  }
    -
    1173 
    -
    1174  //--------------------------------------------------------------------------
    -
    1175  //
    -
    1176  // Diagnostics
    -
    1177  //
    -
    1178  //--------------------------------------------------------------------------
    -
    1179 
    -
    1180  Counts const&
    -
    1181  counts() const
    -
    1182  {
    -
    1183  return counts_;
    -
    1184  }
    -
    1185 
    -
    1186  static std::string
    - -
    1188  {
    -
    1189  switch (state)
    -
    1190  {
    -
    1191  case Slot::accept:
    -
    1192  return "accept";
    -
    1193  case Slot::connect:
    -
    1194  return "connect";
    -
    1195  case Slot::connected:
    -
    1196  return "connected";
    -
    1197  case Slot::active:
    -
    1198  return "active";
    -
    1199  case Slot::closing:
    -
    1200  return "closing";
    -
    1201  default:
    -
    1202  break;
    -
    1203  };
    -
    1204  return "?";
    -
    1205  }
    -
    1206 };
    -
    1207 
    -
    1208 //------------------------------------------------------------------------------
    -
    1209 
    -
    1210 template <class Checker>
    -
    1211 template <class FwdIter>
    -
    1212 void
    - -
    1214  FwdIter first,
    -
    1215  FwdIter last,
    -
    1216  boost::asio::ip::tcp::endpoint const& remote_address)
    -
    1217 {
    -
    1218  std::lock_guard _(lock_);
    -
    1219  std::size_t n = 0;
    -
    1220  for (; first != last && n < Tuning::maxRedirects; ++first, ++n)
    -
    1221  bootcache_.insert(beast::IPAddressConversion::from_asio(*first));
    -
    1222  if (n > 0)
    -
    1223  {
    -
    1224  JLOG(m_journal.trace()) << beast::leftw(18) << "Logic add " << n
    -
    1225  << " redirect IPs from " << remote_address;
    -
    1226  }
    -
    1227 }
    +
    1116  // Returns true if the IP::Endpoint contains no invalid data.
    +
    1117  bool
    + +
    1119  {
    +
    1120  if (is_unspecified(address))
    +
    1121  return false;
    +
    1122  if (!is_public(address))
    +
    1123  return false;
    +
    1124  if (address.port() == 0)
    +
    1125  return false;
    +
    1126  return true;
    +
    1127  }
    +
    1128 
    +
    1129  //--------------------------------------------------------------------------
    +
    1130  //
    +
    1131  // PropertyStream
    +
    1132  //
    +
    1133  //--------------------------------------------------------------------------
    +
    1134 
    +
    1135  void
    + +
    1137  {
    +
    1138  for (auto const& entry : slots)
    +
    1139  {
    + +
    1141  SlotImp const& slot(*entry.second);
    +
    1142  if (slot.local_endpoint() != std::nullopt)
    +
    1143  item["local_address"] = to_string(*slot.local_endpoint());
    +
    1144  item["remote_address"] = to_string(slot.remote_endpoint());
    +
    1145  if (slot.inbound())
    +
    1146  item["inbound"] = "yes";
    +
    1147  if (slot.fixed())
    +
    1148  item["fixed"] = "yes";
    +
    1149  if (slot.reserved())
    +
    1150  item["reserved"] = "yes";
    +
    1151 
    +
    1152  item["state"] = stateString(slot.state());
    +
    1153  }
    +
    1154  }
    +
    1155 
    +
    1156  void
    + +
    1158  {
    + +
    1160 
    +
    1161  // VFALCO NOTE These ugly casts are needed because
    +
    1162  // of how std::size_t is declared on some linuxes
    +
    1163  //
    +
    1164  map["bootcache"] = std::uint32_t(bootcache_.size());
    +
    1165  map["fixed"] = std::uint32_t(fixed_.size());
    +
    1166 
    +
    1167  {
    +
    1168  beast::PropertyStream::Set child("peers", map);
    +
    1169  writeSlots(child, slots_);
    +
    1170  }
    +
    1171 
    +
    1172  {
    +
    1173  beast::PropertyStream::Map child("counts", map);
    +
    1174  counts_.onWrite(child);
    +
    1175  }
    +
    1176 
    +
    1177  {
    +
    1178  beast::PropertyStream::Map child("config", map);
    +
    1179  config_.onWrite(child);
    +
    1180  }
    +
    1181 
    +
    1182  {
    +
    1183  beast::PropertyStream::Map child("livecache", map);
    +
    1184  livecache_.onWrite(child);
    +
    1185  }
    +
    1186 
    +
    1187  {
    +
    1188  beast::PropertyStream::Map child("bootcache", map);
    +
    1189  bootcache_.onWrite(child);
    +
    1190  }
    +
    1191  }
    +
    1192 
    +
    1193  //--------------------------------------------------------------------------
    +
    1194  //
    +
    1195  // Diagnostics
    +
    1196  //
    +
    1197  //--------------------------------------------------------------------------
    +
    1198 
    +
    1199  Counts const&
    +
    1200  counts() const
    +
    1201  {
    +
    1202  return counts_;
    +
    1203  }
    +
    1204 
    +
    1205  static std::string
    + +
    1207  {
    +
    1208  switch (state)
    +
    1209  {
    +
    1210  case Slot::accept:
    +
    1211  return "accept";
    +
    1212  case Slot::connect:
    +
    1213  return "connect";
    +
    1214  case Slot::connected:
    +
    1215  return "connected";
    +
    1216  case Slot::active:
    +
    1217  return "active";
    +
    1218  case Slot::closing:
    +
    1219  return "closing";
    +
    1220  default:
    +
    1221  break;
    +
    1222  };
    +
    1223  return "?";
    +
    1224  }
    +
    1225 };
    +
    1226 
    +
    1227 //------------------------------------------------------------------------------
    1228 
    -
    1229 } // namespace PeerFinder
    -
    1230 } // namespace ripple
    -
    1231 
    -
    1232 #endif
    +
    1229 template <class Checker>
    +
    1230 template <class FwdIter>
    +
    1231 void
    + +
    1233  FwdIter first,
    +
    1234  FwdIter last,
    +
    1235  boost::asio::ip::tcp::endpoint const& remote_address)
    +
    1236 {
    +
    1237  std::lock_guard _(lock_);
    +
    1238  std::size_t n = 0;
    +
    1239  for (; first != last && n < Tuning::maxRedirects; ++first, ++n)
    +
    1240  bootcache_.insert(beast::IPAddressConversion::from_asio(*first));
    +
    1241  if (n > 0)
    +
    1242  {
    +
    1243  JLOG(m_journal.trace()) << beast::leftw(18) << "Logic add " << n
    +
    1244  << " redirect IPs from " << remote_address;
    +
    1245  }
    +
    1246 }
    +
    1247 
    +
    1248 } // namespace PeerFinder
    +
    1249 } // namespace ripple
    +
    1250 
    +
    1251 #endif
    Tests remote listening sockets to make sure they are connectible.
    Definition: Checker.h:39
    @@ -1298,7 +1317,7 @@ $(function() {
    STL class.
    STL class.
    -
    void get_fixed(std::size_t needed, Container &c, typename ConnectHandouts::Squelches &squelches)
    Adds eligible Fixed addresses for outbound attempts.
    +
    void get_fixed(std::size_t needed, Container &c, typename ConnectHandouts::Squelches &squelches)
    Adds eligible Fixed addresses for outbound attempts.
    Stream trace() const
    Severity stream access functions.
    Definition: Journal.h:308
    @@ -1313,7 +1332,7 @@ $(function() {
    STL class.
    T find(T... args)
    T size(T... args)
    -
    void on_failure(SlotImp::ptr const &slot)
    +
    void on_failure(SlotImp::ptr const &slot)
    Logic(clock_type &clock, Store &store, Checker &checker, beast::Journal journal)
    void onWrite(beast::PropertyStream::Map &map)
    Output statistics.
    Definition: Livecache.h:472
    constexpr std::chrono::seconds secondsPerMessage(151)
    @@ -1326,13 +1345,13 @@ $(function() {
    Address const & address() const
    Returns the address portion of this endpoint.
    Definition: IPEndpoint.h:76
    auto insert(value_type const &value) -> typename std::enable_if<!maybe_multi, std::pair< iterator, bool >>::type
    T emplace(T... args)
    -
    void onRedirects(FwdIter first, FwdIter last, boost::asio::ip::tcp::endpoint const &remote_address)
    +
    void onRedirects(FwdIter first, FwdIter last, boost::asio::ip::tcp::endpoint const &remote_address)
    void addFixedPeer(std::string const &name, std::vector< beast::IP::Endpoint > const &addresses)
    Stream warn() const
    Definition: Journal.h:326
    STL class.
    constexpr std::uint32_t numberOfEndpointsMax
    -
    Counts const & counts() const
    +
    Counts const & counts() const
    void periodicActivity()
    Stores the cache in the persistent database on a timer.
    Definition: Bootcache.cpp:199
    T any_of(T... args)
    @@ -1359,13 +1378,13 @@ $(function() {
    boost::asio::ip::address Address
    Definition: IPAddress.h:41
    A public key.
    Definition: PublicKey.h:61
    -
    void addStaticSource(std::shared_ptr< Source > const &source)
    +
    void addStaticSource(std::shared_ptr< Source > const &source)
    Stores IP addresses useful for gaining initial connections.
    Definition: Bootcache.h:51
    -
    std::vector< std::pair< std::shared_ptr< Slot >, std::vector< Endpoint > > > buildEndpointsForPeers()
    +
    std::vector< std::pair< std::shared_ptr< Slot >, std::vector< Endpoint > > > buildEndpointsForPeers()
    bool insert(beast::IP::Endpoint const &endpoint)
    Add a newly-learned address to the cache.
    Definition: Bootcache.cpp:111
    -
    std::vector< Endpoint > redirect(SlotImp::ptr const &slot)
    Return a list of addresses suitable for redirection.
    -
    void onWrite(beast::PropertyStream::Map &map)
    +
    std::vector< Endpoint > redirect(SlotImp::ptr const &slot)
    Return a list of addresses suitable for redirection.
    +
    void onWrite(beast::PropertyStream::Map &map)
    int out_active() const
    Returns the number of outbound peers assigned an open slot.
    Definition: Counts.h:112
    @@ -1381,12 +1400,12 @@ $(function() {
    Stream error() const
    Definition: Journal.h:332
    Stream info() const
    Definition: Journal.h:320
    -
    std::vector< beast::IP::Endpoint > autoconnect()
    Create new outbound connection attempts as needed.
    +
    std::vector< beast::IP::Endpoint > autoconnect()
    Create new outbound connection attempts as needed.
    T erase(T... args)
    Port port() const
    Returns the port number on the endpoint.
    Definition: IPEndpoint.h:62
    void onConfig(Config const &config)
    Called when the config is set or changed.
    Definition: Counts.h:135
    -
    bool fixed(beast::IP::Address const &address) const
    +
    bool fixed(beast::IP::Address const &address) const
    The Livecache holds the short-lived relayed Endpoint messages.
    Definition: Livecache.h:39
    std::optional< beast::IP::Endpoint > const & local_endpoint() const override
    The local endpoint of the socket, when known.
    Definition: SlotImp.h:82
    void addFixedPeer(std::string const &name, beast::IP::Endpoint const &ep)
    @@ -1400,19 +1419,19 @@ $(function() {
    void checkComplete(beast::IP::Endpoint const &remoteAddress, beast::IP::Endpoint const &checkedAddress, boost::system::error_code ec)
    std::shared_ptr< Source > fetchSource_
    Result activate(SlotImp::ptr const &slot, PublicKey const &key, bool reserved)
    -
    void addSource(std::shared_ptr< Source > const &source)
    +
    void addSource(std::shared_ptr< Source > const &source)
    boost::asio::ip::address_v6 AddressV6
    Definition: IPAddressV6.h:34
    boost::system::error_code error
    Definition: Source.h:46
    -
    void fetch(std::shared_ptr< Source > const &source)
    +
    void fetch(std::shared_ptr< Source > const &source)
    void onWrite(beast::PropertyStream::Map &map)
    Write the cache state to the property stream.
    Definition: Bootcache.cpp:207
    -
    static std::string stateString(Slot::State state)
    +
    static std::string stateString(Slot::State state)
    void on_success(beast::IP::Endpoint const &endpoint)
    Called when an outbound connection handshake completes.
    Definition: Bootcache.cpp:147
    -
    void remove(SlotImp::ptr const &slot)
    +
    void remove(SlotImp::ptr const &slot)
    class ripple::PeerFinder::Livecache::hops_t hops
    - +
    Left justifies a field at the specified width.
    Definition: iosformat.h:33
    void handout(TargetFwdIter first, TargetFwdIter last, SeqFwdIter seq_first, SeqFwdIter seq_last)
    Distributes objects to targets according to business rules.
    Definition: Handouts.h:67
    Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
    @@ -1422,11 +1441,12 @@ $(function() {
    std::uint16_t listeningPort
    The listening port number.
    Associative container where each element is also indexed by time.
    std::size_t fixed_active() const
    Returns the number of active fixed connections.
    Definition: Counts.h:126
    -
    bool fixed(beast::IP::Endpoint const &endpoint) const
    +
    bool fixed(beast::IP::Endpoint const &endpoint) const
    bool try_insert(beast::IP::Endpoint const &endpoint)
    Definition: Handouts.h:332
    T cbegin(T... args)
    std::size_t attempts() const
    Returns the number of outbound connection attempts.
    Definition: Counts.h:96
    void async_connect(beast::IP::Endpoint const &endpoint, Handler &&handler)
    Performs an async connection test on the specified endpoint.
    Definition: Checker.h:207
    +
    void LogicError(std::string const &how) noexcept
    Called when faulty logic causes a broken invariant.
    Definition: contract.cpp:48
    void set_listening_port(std::uint16_t port)
    Definition: SlotImp.h:103
    void add(Slot const &s)
    Adds the slot state and properties to the slot counts.
    Definition: Counts.h:57
    void expire()
    Erase entries whose time has expired.
    Definition: Livecache.h:405
    @@ -1435,18 +1455,18 @@ $(function() {
    void touch(beast::detail::aged_container_iterator< is_const, Iterator > pos)
    void onWrite(beast::PropertyStream::Map &map)
    Output statistics.
    Definition: Counts.h:227
    T count(T... args)
    -
    void writeSlots(beast::PropertyStream::Set &set, Slots const &slots)
    +
    void writeSlots(beast::PropertyStream::Set &set, Slots const &slots)
    T empty(T... args)
    -
    void preprocess(SlotImp::ptr const &slot, Endpoints &list)
    +
    void preprocess(SlotImp::ptr const &slot, Endpoints &list)
    Stream debug() const
    Definition: Journal.h:314
    std::string to_string(Manifest const &m)
    Format the specified manifest to a string for debugging purposes.
    const_iterator begin() const
    IP::Endpoint iterators that traverse in decreasing valence.
    Definition: Bootcache.cpp:55
    T make_pair(T... args)
    -
    bool is_valid_address(beast::IP::Endpoint const &address)
    +
    bool is_valid_address(beast::IP::Endpoint const &address)
    A version-independent IP address and port combination.
    Definition: IPEndpoint.h:38
    T end(T... args)
    std::shared_ptr< SlotImp > ptr
    Definition: SlotImp.h:36
    @@ -1454,7 +1474,7 @@ $(function() {
    constexpr std::uint32_t maxHops
    PeerFinder configuration settings.
    std::size_t attempts_needed() const
    Returns the number of attempts needed to bring us to the max.
    Definition: Counts.h:87
    -
    void on_closed(SlotImp::ptr const &slot)
    +
    void on_closed(SlotImp::ptr const &slot)
    State state() const override
    Returns the state of the connection.
    Definition: SlotImp.h:70
    Endpoint at_port(Port port) const
    Returns a new Endpoint with a different port.
    Definition: IPEndpoint.h:69
    @@ -1478,8 +1498,8 @@ $(function() {
    T ref(T... args)
    bool fixed() const override
    Returns true if this is a fixed connection.
    Definition: SlotImp.h:58
    beast::IP::Endpoint const & remote_endpoint() const override
    The remote endpoint of socket.
    Definition: SlotImp.h:76
    -
    int addBootcacheAddresses(IPAddresses const &list)
    -
    void on_endpoints(SlotImp::ptr const &slot, Endpoints list)
    +
    int addBootcacheAddresses(IPAddresses const &list)
    +
    void on_endpoints(SlotImp::ptr const &slot, Endpoints list)
    Result
    Possible results from activating a slot.
    diff --git a/search/all_14.js b/search/all_14.js index 8252471fb2..4b950f087e 100644 --- a/search/all_14.js +++ b/search/all_14.js @@ -91,7 +91,7 @@ var searchData= ['tecfailed_5fprocessing_10412',['tecFAILED_PROCESSING',['../namespaceripple.html#aa298e929e02f59c2b05a30ee8805b38caecd11145ac07375d1c0793e699932969',1,'ripple']]], ['tecfrozen_10413',['tecFROZEN',['../namespaceripple.html#aa298e929e02f59c2b05a30ee8805b38ca608da193a4a22ae1c78d76b6e843b7e6',1,'ripple']]], ['techas_5fobligations_10414',['tecHAS_OBLIGATIONS',['../namespaceripple.html#aa298e929e02f59c2b05a30ee8805b38caa7460a5fac26c1d8abef55b8c1129150',1,'ripple']]], - ['techook_5ferror_10415',['tecHOOK_ERROR',['../namespaceripple.html#aa298e929e02f59c2b05a30ee8805b38ca692765f2dd842dbb86d574d0e5c09d76',1,'ripple']]], + ['techook_5frejected_10415',['tecHOOK_REJECTED',['../namespaceripple.html#aa298e929e02f59c2b05a30ee8805b38ca13e98f572a44ff062a74288a581d2715',1,'ripple']]], ['tecincomplete_10416',['tecINCOMPLETE',['../namespaceripple.html#aa298e929e02f59c2b05a30ee8805b38ca576f5411ab4458ec9842480e7ebe7072',1,'ripple']]], ['tecinsuf_5freserve_5fline_10417',['tecINSUF_RESERVE_LINE',['../namespaceripple.html#aa298e929e02f59c2b05a30ee8805b38ca2d4a898185a9c8e604210e789bed6e36',1,'ripple']]], ['tecinsuf_5freserve_5foffer_10418',['tecINSUF_RESERVE_OFFER',['../namespaceripple.html#aa298e929e02f59c2b05a30ee8805b38ca30792765079d182f869612fc3b96ef8c',1,'ripple']]], diff --git a/search/enumvalues_13.js b/search/enumvalues_13.js index 2ccbe8eed4..57e6801885 100644 --- a/search/enumvalues_13.js +++ b/search/enumvalues_13.js @@ -23,7 +23,7 @@ var searchData= ['tecfailed_5fprocessing_28379',['tecFAILED_PROCESSING',['../namespaceripple.html#aa298e929e02f59c2b05a30ee8805b38caecd11145ac07375d1c0793e699932969',1,'ripple']]], ['tecfrozen_28380',['tecFROZEN',['../namespaceripple.html#aa298e929e02f59c2b05a30ee8805b38ca608da193a4a22ae1c78d76b6e843b7e6',1,'ripple']]], ['techas_5fobligations_28381',['tecHAS_OBLIGATIONS',['../namespaceripple.html#aa298e929e02f59c2b05a30ee8805b38caa7460a5fac26c1d8abef55b8c1129150',1,'ripple']]], - ['techook_5ferror_28382',['tecHOOK_ERROR',['../namespaceripple.html#aa298e929e02f59c2b05a30ee8805b38ca692765f2dd842dbb86d574d0e5c09d76',1,'ripple']]], + ['techook_5frejected_28382',['tecHOOK_REJECTED',['../namespaceripple.html#aa298e929e02f59c2b05a30ee8805b38ca13e98f572a44ff062a74288a581d2715',1,'ripple']]], ['tecincomplete_28383',['tecINCOMPLETE',['../namespaceripple.html#aa298e929e02f59c2b05a30ee8805b38ca576f5411ab4458ec9842480e7ebe7072',1,'ripple']]], ['tecinsuf_5freserve_5fline_28384',['tecINSUF_RESERVE_LINE',['../namespaceripple.html#aa298e929e02f59c2b05a30ee8805b38ca2d4a898185a9c8e604210e789bed6e36',1,'ripple']]], ['tecinsuf_5freserve_5foffer_28385',['tecINSUF_RESERVE_OFFER',['../namespaceripple.html#aa298e929e02f59c2b05a30ee8805b38ca30792765079d182f869612fc3b96ef8c',1,'ripple']]],