aboutsummaryrefslogtreecommitdiffstats
path: root/src/swarm/sync.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/swarm/sync.rs')
-rw-r--r--src/swarm/sync.rs5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/swarm/sync.rs b/src/swarm/sync.rs
index 18c017c..772932d 100644
--- a/src/swarm/sync.rs
+++ b/src/swarm/sync.rs
@@ -145,8 +145,7 @@ async fn deliver_sync_to_peer(state: &AppState, peer: &str) -> Result<()> {
peer_state
.sync
.generate(&mut replica.doc, Instant::now(), bytes_before);
- let body = message.map(|message| {
- let payload = transport::SyncPayload::encode(message);
+ let body = message.map(|payload| {
if payload.0.len() <= delta_threshold {
return transport::SyncBody::Message(payload);
}
@@ -356,7 +355,7 @@ pub(crate) async fn handle_sync(
// to another epoch.
tokio::task::spawn_blocking(move || -> Result<Option<(bool, bool)>> {
// Before the lock: decoding a large message takes a while.
- let message = message.decode()?;
+ let message = crate::state::decode_sync(&message)?;
let mut replica = doc.blocking_write();
// Authoritative check, under the same lock as the apply: the document may