aboutsummaryrefslogtreecommitdiffstats
path: root/src/swarm
diff options
context:
space:
mode:
Diffstat (limited to 'src/swarm')
-rw-r--r--src/swarm/sync.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/swarm/sync.rs b/src/swarm/sync.rs
index d28df33..681a3bb 100644
--- a/src/swarm/sync.rs
+++ b/src/swarm/sync.rs
@@ -169,9 +169,15 @@ async fn deliver_sync_to_peer(state: &AppState, peer: &str) -> Result<()> {
Instant::now(),
);
// Along a tree, taken as delivered: the changes as they are, if pushing
- // (`AppState::push_changes`).
+ // (`AppState::push_changes`). Only those too small to deflate: larger
+ // ones go as a message, deflated (`compress`).
let pushed = (push_changes && level && writer.is_some() && again.is_none())
- .then(|| peer_state.sync.push(&replica.doc, delta_threshold))
+ .then(|| {
+ peer_state.sync.push(
+ &replica.doc,
+ delta_threshold.min(crate::compress::WORTH_FROM - 1),
+ )
+ })
.flatten();
let body = if let Some((heads, changes)) = pushed {
Some(transport::SyncBody::Changes {