diff options
| author | tv <tv@krebsco.de> | 2026-10-26 18:51:01 +0100 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-10-26 18:51:01 +0100 |
| commit | 93f1cc4005937667015c1554c9efdc10a5f781d2 (patch) | |
| tree | 70abb8e436376b32c90cc49351d51768b978ee8e /src/swarm/relay.rs | |
| parent | 1c78c817472de3c57aabf1bd8d0f44a4fdf512ff (diff) | |
read stamps sync and lock free
Diffstat (limited to 'src/swarm/relay.rs')
| -rw-r--r-- | src/swarm/relay.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/swarm/relay.rs b/src/swarm/relay.rs index 4bfc2b6..34451c9 100644 --- a/src/swarm/relay.rs +++ b/src/swarm/relay.rs @@ -103,8 +103,9 @@ pub(crate) async fn pull_if_behind(state: &AppState, peer: &str, remote: &transp if remote.epoch != state.local_epoch() || !topology::is_neighbour(state, peer) { return; } - // The common case, the same heads, needs only the cached heads (read lock). - if HeadsSummary::of(state.doc.read().await.heads().to_vec()) == remote.heads { + // The common case, the same heads, needs only the published heads. + let ours = HeadsSummary::of(state.stamp.borrow().heads.to_vec()); + if ours == remote.heads { return; } let missing = match &remote.heads { |
