aboutsummaryrefslogtreecommitdiffstats
path: root/src/swarm/links.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/swarm/links.rs')
-rw-r--r--src/swarm/links.rs18
1 files changed, 12 insertions, 6 deletions
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);