20#include <xrpld/app/misc/HashRouter.h> 
   21#include <xrpld/core/Config.h> 
   28    auto iter = suppressionMap_.find(key);
 
   30    if (iter != suppressionMap_.end())
 
   32        suppressionMap_.touch(iter);
 
   37    expire(suppressionMap_, setup_.holdTime);
 
   40        std::ref(suppressionMap_.emplace(key, 
Entry()).first->second), 
true);
 
 
   63    result.first.addPeer(peer);
 
   64    return {result.second, result.first.relayed()};
 
 
   75    auto [s, created] = 
emplace(key);
 
 
   91    auto& s = result.first;
 
 
  102    return emplace(key).first.getFlags();
 
 
  109        static_cast<bool>(flags), 
"ripple::HashRouter::setFlags : valid input");
 
  115    if ((s.getFlags() & flags) == flags)
 
 
  128    auto& s = emplace(key).first;
 
  130    if (!s.shouldRelay(suppressionMap_.clock().now(), setup_.relayTime))
 
  133    return s.releasePeerSet();
 
 
  142    auto const& section = config.
section(
"hashrouter");
 
  146    if (
set(tmp, 
"hold_time", section))
 
  149            Throw<std::runtime_error>(
 
  150                "HashRouter hold time must be at least 12 seconds (the " 
  151                "approximate validation time for three ledgers).");
 
  154    if (
set(tmp, 
"relay_time", section))
 
  157            Throw<std::runtime_error>(
 
  158                "HashRouter relay time must be at least 8 seconds (the " 
  159                "approximate validation time for two ledgers).");
 
  164        Throw<std::runtime_error>(
 
  165            "HashRouter relay time must be less than or equal to hold time");
 
 
Section & section(std::string const &name)
Returns the section with the given name.
 
An entry in the routing table.
 
beast::aged_unordered_map< uint256, Entry, Stopwatch::clock_type, hardened_hash< strong_hash > > suppressionMap_
 
HashRouterFlags getFlags(uint256 const &key)
 
std::optional< std::set< PeerShortID > > shouldRelay(uint256 const &key)
Determines whether the hashed item should be relayed.
 
bool shouldProcess(uint256 const &key, PeerShortID peer, HashRouterFlags &flags, std::chrono::seconds tx_interval)
 
bool addSuppressionPeer(uint256 const &key, PeerShortID peer)
 
bool setFlags(uint256 const &key, HashRouterFlags flags)
Set the flags on a hash.
 
std::pair< bool, std::optional< Stopwatch::time_point > > addSuppressionPeerWithStatus(uint256 const &key, PeerShortID peer)
Add a suppression peer and get message's relay status.
 
std::pair< Entry &, bool > emplace(uint256 const &)
 
void addSuppression(uint256 const &key)
 
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
 
HashRouter::Setup setup_HashRouter(Config const &config)
 
Structure used to customize HashRouter behavior.
 
seconds holdTime
Expiration time for a hash entry.
 
seconds relayTime
Amount of time required before a relayed item will be relayed again.