20 #ifndef RIPPLE_OVERLAY_SQUELCH_H_INCLUDED
21 #define RIPPLE_OVERLAY_SQUELCH_H_INCLUDED
23 #include <ripple/basics/random.h>
24 #include <ripple/beast/utility/Journal.h>
25 #include <ripple/overlay/ReduceRelayCommon.h>
26 #include <ripple/protocol/PublicKey.h>
34 namespace reduce_relay {
37 template <
typename clock_type>
78 template <
typename clock_type>
87 squelched_[validator] = clock_type::now() + squelchDuration;
91 JLOG(journal_.error()) <<
"squelch: invalid squelch duration "
92 << squelchDuration.
count();
95 removeSquelch(validator);
100 template <
typename clock_type>
104 squelched_.erase(validator);
107 template <
typename clock_type>
111 auto now = clock_type::now();
113 auto const& it = squelched_.find(validator);
114 if (it == squelched_.end())
116 else if (it->second > now)
120 squelched_.erase(it);
129 #endif // RIPPLED_SQUELCH_H
typename ripple::UptimeClock ::time_point time_point
virtual ~Squelch()=default
void removeSquelch(PublicKey const &validator)
Remove the squelch.
bool addSquelch(PublicKey const &validator, std::chrono::seconds const &squelchDuration)
Squelch validation/proposal relaying for the validator.
bool expireSquelch(PublicKey const &validator)
Remove expired squelch.
Maintains squelching of relaying messages from validators.
A generic endpoint for log messages.
static constexpr auto MIN_UNSQUELCH_EXPIRE
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
const beast::Journal journal_
static constexpr auto MAX_UNSQUELCH_EXPIRE_PEERS
hash_map< PublicKey, time_point > squelched_
Maintains the list of squelched relaying to downstream peers.
Squelch(beast::Journal journal)