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>
62 squelched_[validator] = clock_type::now() + squelchDuration;
66 JLOG(journal_.error()) <<
"squelch: invalid squelch duration " << squelchDuration.
count();
69 removeSquelch(validator);
74template <
typename clock_type>
78 squelched_.erase(validator);
81template <
typename clock_type>
85 auto now = clock_type::now();
87 auto const& it = squelched_.find(validator);
88 if (it == squelched_.end())
90 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.