3#include <xrpld/overlay/ReduceRelayCommon.h>
5#include <xrpl/beast/utility/Journal.h>
6#include <xrpl/protocol/PublicKey.h>
14namespace reduce_relay {
17template <
typename clock_type>
56template <
typename clock_type>
64 squelched_[validator] = clock_type::now() + squelchDuration;
68 JLOG(journal_.error()) <<
"squelch: invalid squelch duration " << squelchDuration.
count();
71 removeSquelch(validator);
76template <
typename clock_type>
80 squelched_.erase(validator);
83template <
typename clock_type>
87 auto now = clock_type::now();
89 auto const& it = squelched_.find(validator);
90 if (it == squelched_.end())
92 else if (it->second > now)
A generic endpoint for log messages.
Maintains squelching of relaying messages from validators.
bool addSquelch(PublicKey const &validator, std::chrono::seconds const &squelchDuration)
Squelch validation/proposal relaying for the validator.
beast::Journal const journal_
virtual ~Squelch()=default
typename clock_type::time_point time_point
void removeSquelch(PublicKey const &validator)
Remove the squelch.
bool expireSquelch(PublicKey const &validator)
Remove expired squelch.
Squelch(beast::Journal journal)
hash_map< PublicKey, time_point > squelched_
Maintains the list of squelched relaying to downstream peers.
static constexpr auto MAX_UNSQUELCH_EXPIRE_PEERS
static constexpr auto MIN_UNSQUELCH_EXPIRE
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.