diff options
Diffstat (limited to 'src/transport')
| -rw-r--r-- | src/transport/mod.rs | 3 | ||||
| -rw-r--r-- | src/transport/mycelium.rs | 3 |
2 files changed, 6 insertions, 0 deletions
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<u64>, } #[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<u64>, } #[derive(Serialize, Deserialize)] @@ -972,6 +973,7 @@ pub fn hello_reply_to_bytes(msg: &HelloReply) -> Result<Vec<u8>, 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<HelloReply, TransportError> auth: shadow.auth.into_vec(), ready: shadow.ready, run_id: run_id_from_shadow(&shadow.run_id)?, + away_ms: shadow.away_ms, }) } |
