aboutsummaryrefslogtreecommitdiffstats
path: root/src/swarm/refusals.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/swarm/refusals.rs')
-rw-r--r--src/swarm/refusals.rs14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/swarm/refusals.rs b/src/swarm/refusals.rs
index af4252c..30c3971 100644
--- a/src/swarm/refusals.rs
+++ b/src/swarm/refusals.rs
@@ -53,15 +53,25 @@ pub(crate) async fn tell(
/// rules have it now; if they refuse one, we took it unjudged, and drop it.
pub(crate) async fn received(state: &AppState, peer: &str, message: RefusalsMessage) {
let doc = std::sync::Arc::clone(&state.doc);
+ let screening = std::sync::Arc::clone(&state.screening);
let changes: Vec<ChangeHash> = message.changes.into_iter().take(MAX_LISTED).collect();
let judged = tokio::task::spawn_blocking(move || {
+ use crate::locks::MutexExt;
let replica = doc.blocking_read();
if replica.epoch != message.epoch {
return None;
}
+ // Without a policy, ever (`Screening::policed`), nothing to judge by; with one
+ // this node doesn't know now, it can't judge as they do: receiving without
+ // judging until upgraded. A policy gone since still judges what was written under
+ // it, each change at its dependencies.
let policy = crate::access::policy::of(&replica.doc);
- if !policy.enforced() || matches!(policy, crate::access::policy::Policy::Unknown(_)) {
- // We can't judge as they do: receiving without judging until upgraded.
+ if matches!(policy, crate::access::policy::Policy::Unknown(_))
+ || !screening
+ .lock_or_recover()
+ .of(replica.epoch_seq)
+ .policed(&replica.doc)
+ {
return None;
}
let mut refused = None;