20#ifndef RIPPLE_OVERLAY_SQUELCH_H_INCLUDED
21#define RIPPLE_OVERLAY_SQUELCH_H_INCLUDED
23#include <xrpld/overlay/ReduceRelayCommon.h>
25#include <xrpl/beast/utility/Journal.h>
26#include <xrpl/protocol/PublicKey.h>
34namespace reduce_relay {
37template <
typename clock_type>
78template <
typename clock_type>
87 squelched_[validator] = clock_type::now() + squelchDuration;
91 JLOG(journal_.error()) <<
"squelch: invalid squelch duration "
92 << squelchDuration.
count();
95 removeSquelch(validator);
100template <
typename clock_type>
104 squelched_.erase(validator);
107template <
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);
A generic endpoint for log messages.
Maintains squelching of relaying messages from validators.
typename clock_type::time_point time_point
beast::Journal const journal_
hash_map< PublicKey, time_point > squelched_
Maintains the list of squelched relaying to downstream peers.
virtual ~Squelch()=default
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.
void removeSquelch(PublicKey const &validator)
Remove the squelch.
Squelch(beast::Journal journal)
static constexpr auto MIN_UNSQUELCH_EXPIRE
static constexpr auto MAX_UNSQUELCH_EXPIRE_PEERS
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.