From 8c7897b03cb35516b7542544541b98694b40bf6f Mon Sep 17 00:00:00 2001 From: tv Date: Sat, 24 Oct 2026 05:37:20 +0200 Subject: assess swarm stability --- src/transport/mod.rs | 3 +++ src/transport/mycelium.rs | 3 +++ 2 files changed, 6 insertions(+) (limited to 'src/transport') diff --git a/src/transport/mod.rs b/src/transport/mod.rs index e8d654d..19c4126 100644 --- a/src/transport/mod.rs +++ b/src/transport/mod.rs @@ -139,6 +139,9 @@ pub struct HelloReply { /// The `run_id` of the HELLO answered. A reply to a HELLO from an earlier run of the /// recipient (delivered late, or queued while it was down) is ignored. pub run_id: RunId, + /// How long before this HELLO the sender had last heard from the recipient, if ever + /// (in milliseconds): tells a restarted node how long it was away. + pub away_ms: Option, } #[derive(Debug, Clone)] diff --git a/src/transport/mycelium.rs b/src/transport/mycelium.rs index 51bbfab..9075ae8 100644 --- a/src/transport/mycelium.rs +++ b/src/transport/mycelium.rs @@ -892,6 +892,7 @@ pub struct HelloReplyShadow<'a> { auth: ByteBuf, ready: bool, run_id: ByteBuf, + away_ms: Option, } #[derive(Serialize, Deserialize)] @@ -972,6 +973,7 @@ pub fn hello_reply_to_bytes(msg: &HelloReply) -> Result, rmp_serde::enco auth: ByteBuf::from(msg.auth.clone()), ready: msg.ready, run_id: ByteBuf::from(msg.run_id.to_vec()), + away_ms: msg.away_ms, }; rmp_serde::to_vec(&shadow) } @@ -984,6 +986,7 @@ pub fn bytes_to_hello_reply(bytes: &[u8]) -> Result auth: shadow.auth.into_vec(), ready: shadow.ready, run_id: run_id_from_shadow(&shadow.run_id)?, + away_ms: shadow.away_ms, }) } -- cgit v1.3.1