mirror of
https://github.com/Xahau/xahaud.git
synced 2025-11-20 02:25:53 +00:00
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:
@@ -782,10 +782,14 @@ public:
|
|||||||
// Must be handshaked!
|
// Must be handshaked!
|
||||||
assert(slot->state() == Slot::active);
|
assert(slot->state() == Slot::active);
|
||||||
|
|
||||||
preprocess(slot, list);
|
|
||||||
|
|
||||||
clock_type::time_point const now(m_clock.now());
|
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)
|
for (auto const& ep : list)
|
||||||
{
|
{
|
||||||
assert(ep.hops != 0);
|
assert(ep.hops != 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user