diff options
Diffstat (limited to 'src/swarm/peer/inbound.rs')
| -rw-r--r-- | src/swarm/peer/inbound.rs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/swarm/peer/inbound.rs b/src/swarm/peer/inbound.rs index 92a1a5e..0eaefb9 100644 --- a/src/swarm/peer/inbound.rs +++ b/src/swarm/peer/inbound.rs @@ -11,7 +11,7 @@ use super::epoch::observe_peer_epoch; use super::handshake::{ discover_peers, ensure_handshake, establish_peer, peer_swarm, remember_peer, send_hello_reply, }; -use super::keepalive::{heal_if_diverged, local_status, note_status}; +use super::keepalive::{heal_if_diverged, local_status, note_alive, note_status}; use super::lanes::SyncLanes; use crate::state::AppState; use crate::swarm::sync::SyncEvent; @@ -30,6 +30,11 @@ pub(crate) async fn handle_message( debug!("Ignoring message from self"); return Ok(()); } + // PING and PONG only say the peer is alive (`keepalive::note_alive`). + if matches!(message, ParsedMessage::Ping(_) | ParsedMessage::Pong(_)) { + note_alive(state, &peer, &message).await; + return Ok(()); + } // WHO and ME end at the identity layer (`transport::identity`). let Some((epoch, epoch_seq)) = message.epoch_stamp() else { return Ok(()); @@ -154,10 +159,6 @@ pub(crate) async fn handle_message( } } transport::ParsedMessage::StatusReply(remote) => { - // It answers our STATUS: a round-trip sample. - state - .lock_rtt() - .status_reply_received(&peer, Instant::now()); on_status(state, &peer, &remote, reactivated).await; } transport::ParsedMessage::Who(_) |
