aboutsummaryrefslogtreecommitdiffstats
path: root/src/swarm/peer
diff options
context:
space:
mode:
Diffstat (limited to 'src/swarm/peer')
-rw-r--r--src/swarm/peer/keepalive.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/swarm/peer/keepalive.rs b/src/swarm/peer/keepalive.rs
index aa34e70..44f2879 100644
--- a/src/swarm/peer/keepalive.rs
+++ b/src/swarm/peer/keepalive.rs
@@ -41,6 +41,7 @@ pub(crate) async fn announce_heads(state: &AppState, peer: &str, with_reaches: b
let status = transport::Status {
announcing: true,
reaches: local.reaches.filter(|_| with_reaches),
+ round_trips: local.round_trips.filter(|_| with_reaches),
..local
};
state
@@ -189,6 +190,7 @@ pub(crate) async fn local_status(state: &AppState, peer: &str) -> transport::Sta
Some(peer_state) => peer_state.lock().await.syncs_on(epoch),
None => false,
};
+ let (reaches, round_trips) = crate::swarm::reach::published_with_round_trips(state);
transport::Status {
heads,
epoch,
@@ -197,7 +199,8 @@ pub(crate) async fn local_status(state: &AppState, peer: &str) -> transport::Sta
syncs_with_you,
leaving: state.is_closing(),
announcing: false,
- reaches: Some(crate::swarm::reach::published(state)),
+ reaches: Some(reaches),
+ round_trips: Some(round_trips),
}
}
@@ -236,6 +239,10 @@ pub(super) async fn note_status(state: &AppState, peer: &str, remote: &transport
peer_state.last_heads = Some((remote.epoch, remote.heads.clone()));
if let Some(reaches) = &remote.reaches {
peer_state.reaches = Some((Instant::now(), reaches.clone()));
+ peer_state.round_trips = remote
+ .round_trips
+ .clone()
+ .filter(|round_trips| round_trips.len() == reaches.len());
}
drop(peer_state);
if left {