aboutsummaryrefslogtreecommitdiffstats
path: root/src/state/mod.rs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-07 22:35:21 +0100
committertv <tv@krebsco.de>2026-11-07 22:35:21 +0100
commit2ff408c024a0ef5db2a770e8a091783f1b6d9cfc (patch)
tree5350c2290c673049af04ff1c55043087a86f3b14 /src/state/mod.rs
parent63b34dfa41e1595145507a88901e332bf4bd3b14 (diff)
signatures: with sync messages
Sync messages carry, for each actor's writes, the latest signature the sender checked; the receiver checks it once it holds the change. Auth plan M5.
Diffstat (limited to 'src/state/mod.rs')
-rw-r--r--src/state/mod.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/state/mod.rs b/src/state/mod.rs
index 1fc8ea8..ff19124 100644
--- a/src/state/mod.rs
+++ b/src/state/mod.rs
@@ -532,7 +532,8 @@ impl AppState {
&& let [hash] = after[..]
{
if state.sign_every == SignEvery::Change || sign.wanted(&replica.doc) {
- replica.signatures.sign(hash, key);
+ let replica = &mut *replica;
+ replica.signatures.sign(&replica.doc, hash, key);
} else {
replica.signatures.left_unsigned(hash);
}
@@ -565,8 +566,11 @@ impl AppState {
let key = Arc::clone(&key);
let _ = tokio::task::spawn_blocking(move || {
// Looked at first under the read lock: mostly there is nothing to sign.
- state.doc.blocking_read().signatures.pending()
- && state.doc.blocking_write().signatures.sign_latest(&key)
+ state.doc.blocking_read().signatures.pending() && {
+ let mut replica = state.doc.blocking_write();
+ let replica = &mut *replica;
+ replica.signatures.sign_latest(&replica.doc, &key)
+ }
})
.await;
}