From 47ccd0b579f90777a395e48236f13f676ca18618 Mon Sep 17 00:00:00 2001 From: Nik Bougalis Date: Thu, 9 Jun 2022 13:41:38 -0700 Subject: [PATCH] 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. --- src/ripple/peerfinder/impl/Logic.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/ripple/peerfinder/impl/Logic.h b/src/ripple/peerfinder/impl/Logic.h index 4e69c8bd38d..ca14a5111fc 100644 --- a/src/ripple/peerfinder/impl/Logic.h +++ b/src/ripple/peerfinder/impl/Logic.h @@ -782,10 +782,14 @@ class Logic // 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);