diff options
Diffstat (limited to 'src/state.rs')
| -rw-r--r-- | src/state.rs | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/state.rs b/src/state.rs index 23892a9..72013b9 100644 --- a/src/state.rs +++ b/src/state.rs @@ -121,8 +121,11 @@ pub(crate) struct PeerState { /// Epoch the peer advertised in its most recent message. pub(crate) epoch: Option<Epoch>, - /// Whether the peer was ready according to its most recent sync message. + /// Whether the peer was ready according to its most recent sync message or keepalive. pub(crate) reports_ready: Option<bool>, + + /// Whether the peer said, in its most recent keepalive, that it would sync with us. + pub(crate) syncs_with_us: Option<bool>, } /// One Automerge sync with a peer, from a reset to the next. Everything a reset must @@ -326,6 +329,7 @@ impl PeerState { last_resync_at: None, epoch: None, reports_ready: None, + syncs_with_us: None, } } @@ -431,8 +435,8 @@ impl PeerState { /// Self-healing check on PING/PONG. Returns true if a re-handshake should start. pub(crate) fn needs_heal( &mut self, - local: &transport::HeadsDigest, - remote: &transport::HeadsDigest, + local: &transport::HeadsSummary, + remote: &transport::HeadsSummary, timing: &Timing, now: Instant, ) -> bool { @@ -792,11 +796,11 @@ impl AppState { } } - let keepalive = crate::swarm::peer::local_keepalive(self).await; for id in announce { + let keepalive = crate::swarm::peer::local_keepalive(self, id).await; if let Err(error) = self .transport - .send_message(id, &transport::ParsedMessage::Ping(keepalive.clone())) + .send_message(id, &transport::ParsedMessage::Ping(keepalive)) .await { debug!(peer = %id, error = %format!("{error:#}"), "Epoch announcement failed"); |
