1#include <xrpl/core/HashRouter.h>
8 auto iter = suppressionMap_.find(key);
10 if (iter != suppressionMap_.end())
12 suppressionMap_.touch(iter);
17 expire(suppressionMap_, setup_.holdTime);
42 result.first.addPeer(peer);
43 return {result.second, result.first.relayed()};
51 auto [s, created] =
emplace(key);
67 auto& s = result.first;
78 return emplace(key).first.getFlags();
84 XRPL_ASSERT(
static_cast<bool>(flags),
"xrpl::HashRouter::setFlags : valid input");
90 if ((s.getFlags() & flags) == flags)
102 auto& s = emplace(key).first;
104 if (!s.shouldRelay(suppressionMap_.clock().now(), setup_.relayTime))
107 return s.releasePeerSet();
An entry in the routing table.
std::optional< std::set< PeerShortID > > shouldRelay(uint256 const &key)
Determines whether the hashed item should be relayed.
HashRouterFlags getFlags(uint256 const &key)
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 &)
beast::aged_unordered_map< uint256, Entry, Stopwatch::clock_type, hardened_hash< strong_hash > > suppressionMap_
void addSuppression(uint256 const &key)
bool shouldProcess(uint256 const &key, PeerShortID peer, HashRouterFlags &flags, std::chrono::seconds tx_interval)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.