Limit how often endpoint messages can be processed:

The peer discovery protocol depends on peers exchanging messages
listing IP addresses for other peers.

Under normal circumstances, these messages should not be sent
frequently; the existing code would track the earliest time a
new message should be processed, but did not actually enforce
that limit.
This commit is contained in:
Nik Bougalis
2022-06-09 13:41:38 -07:00
parent 5e6728dccd
commit 47ccd0b579

View File

@@ -782,10 +782,14 @@ public:
// Must be handshaked!
assert(slot->state() == Slot::active);
preprocess(slot, list);
clock_type::time_point const now(m_clock.now());
// Limit how often we accept new endpoints
if (slot->whenAcceptEndpoints > now)
return;
preprocess(slot, list);
for (auto const& ep : list)
{
assert(ep.hops != 0);