summaryrefslogtreecommitdiffstats
path: root/src/state.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/state.rs')
-rw-r--r--src/state.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/state.rs b/src/state.rs
index 2bc9264..6021baa 100644
--- a/src/state.rs
+++ b/src/state.rs
@@ -549,6 +549,8 @@ pub(crate) struct AppState {
/// While the initial sync isn't done: the one peer we catch up from.
pub(crate) catch_up_source: Arc<std::sync::Mutex<Option<CatchUpSource>>>,
+ /// Since when a closer peer has had a head start to become the source.
+ pub(crate) catch_up_preference: Arc<std::sync::Mutex<Option<Instant>>>,
}
/// The peer a catching-up node syncs with first (`swarm::source`).
@@ -1029,6 +1031,10 @@ impl Host for AppState {
.catch_up_source
.lock()
.unwrap_or_else(|poisoned| poisoned.into_inner()) = None;
+ *self
+ .catch_up_preference
+ .lock()
+ .unwrap_or_else(|poisoned| poisoned.into_inner()) = None;
}
fn subscribe_changes(&self) -> broadcast::Receiver<Arc<ChangeSet>> {