Track open buffers when handling sync requests
When a host sends a buffer to a guest for the first time, they record that they have done so in a set tied to that guest's peer id. When the guest reconnects and syncs buffers, they do so under a different peer id, so we need to be sure we track which buffers we have sent them to avoid sending them the same buffer twice, which violates the guest's assumptions.
This commit is contained in:
+2
-2
@@ -23,7 +23,7 @@ use std::{
|
||||
time::{Duration, SystemTime},
|
||||
};
|
||||
use tempfile::NamedTempFile;
|
||||
use util::{post_inc, ResultExt};
|
||||
use util::ResultExt;
|
||||
|
||||
#[cfg(any(test, feature = "test-support"))]
|
||||
use collections::{btree_map, BTreeMap};
|
||||
@@ -840,7 +840,7 @@ impl Fs for FakeFs {
|
||||
let target = normalize_path(target);
|
||||
let mut state = self.state.lock().await;
|
||||
let mtime = state.next_mtime;
|
||||
let inode = post_inc(&mut state.next_inode);
|
||||
let inode = util::post_inc(&mut state.next_inode);
|
||||
state.next_mtime += Duration::from_nanos(1);
|
||||
let source_entry = state.read_path(&source).await?;
|
||||
let content = source_entry.lock().await.file_content(&source)?.clone();
|
||||
|
||||
Reference in New Issue
Block a user