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 | 8d70536fd267e7ee730c390b6b47c03ddbef7df9 (patch) | |
| tree | fbbd93242874765903ce7113fe78e3159f304a29 /src/swarm/relay.rs | |
| parent | 8b7bf576d2b3ceb3e5b6cdae7a00989bebb3b4c4 (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 { |
