From 6aec18f10a965797a862360fde3dc8413e529d28 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 3 Nov 2026 07:37:02 +0100 Subject: links: only news pass on --- src/swarm/links.rs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/swarm/links.rs b/src/swarm/links.rs index c430d58..54f18c6 100644 --- a/src/swarm/links.rs +++ b/src/swarm/links.rs @@ -899,15 +899,21 @@ pub(crate) fn received(state: &AppState, peer: &str, reply: LinksReply) { route.arrived = true; } // Not older news over newer. - if inner - .replies - .get(&member) - .is_some_and(|(known, _)| *known > at) - { + let known = inner.replies.get(&member); + if known.is_some_and(|(known, _)| *known > at) { return; } + // The same links as we have, lately: no news, so not passed on. A copy that + // went round between relays (each asking the other for the member) comes + // back a little newer each time, as its age counts from when each sent it: + // passed on, it would go round for good. + let news = known.is_none_or(|(known_at, known_links)| { + *known_links != links || now.saturating_duration_since(*known_at) >= REPLY_WITHIN + }); inner.replies.insert(member.clone(), (at, links)); - arrived.push(member); + if news { + arrived.push(member); + } }; if own { keep(peer.to_owned(), Duration::ZERO, reply.links); -- cgit v1.3.1