diff options
Diffstat (limited to 'src/transport')
| -rw-r--r-- | src/transport/libp2p/tests.rs | 1 | ||||
| -rw-r--r-- | src/transport/mod.rs | 4 | ||||
| -rw-r--r-- | src/transport/mycelium/mod.rs | 1 | ||||
| -rw-r--r-- | src/transport/paths.rs | 1 | ||||
| -rw-r--r-- | src/transport/sim.rs | 1 | ||||
| -rw-r--r-- | src/transport/wire.rs | 8 |
6 files changed, 14 insertions, 2 deletions
diff --git a/src/transport/libp2p/tests.rs b/src/transport/libp2p/tests.rs index 8f77bf7..7bedeaa 100644 --- a/src/transport/libp2p/tests.rs +++ b/src/transport/libp2p/tests.rs @@ -61,6 +61,7 @@ fn status() -> ParsedMessage { leaving: false, announcing: false, eager: false, + reaches: None, }) } diff --git a/src/transport/mod.rs b/src/transport/mod.rs index 22782ef..9ae8ff2 100644 --- a/src/transport/mod.rs +++ b/src/transport/mod.rs @@ -210,6 +210,10 @@ pub(crate) struct Status { /// sent as sync messages (an eager link, `swarm::relay`), not only announced. Every /// STATUS says so, or not, again: one lost changes nothing for long. pub(crate) eager: bool, + /// Whom the sender reaches (`swarm::reach`): the pair keys (`topology::pair_key`) + /// of the members it has an active session with, sorted. In keepalive STATUSes and + /// their replies, and when it changed; not in announcements of heads (None). + pub(crate) reaches: Option<Vec<u64>>, } /// Cheap to clone: large parts are shared (`bytes::Bytes`). diff --git a/src/transport/mycelium/mod.rs b/src/transport/mycelium/mod.rs index 0562e72..76ef8cd 100644 --- a/src/transport/mycelium/mod.rs +++ b/src/transport/mycelium/mod.rs @@ -719,6 +719,7 @@ mod tests { leaving: false, announcing: false, eager: false, + reaches: None, }; let payload = wire::encode(&ParsedMessage::StatusReply(status.clone())).unwrap(); // Mycelium's message data: a length byte, the topic, then our payload. diff --git a/src/transport/paths.rs b/src/transport/paths.rs index 1cd21e8..3e595ab 100644 --- a/src/transport/paths.rs +++ b/src/transport/paths.rs @@ -1515,6 +1515,7 @@ mod tests { leaving: false, announcing: false, eager: false, + reaches: None, }) } diff --git a/src/transport/sim.rs b/src/transport/sim.rs index af262aa..c9e45fb 100644 --- a/src/transport/sim.rs +++ b/src/transport/sim.rs @@ -389,6 +389,7 @@ mod tests { leaving: false, announcing: false, eager: false, + reaches: None, }) } diff --git a/src/transport/wire.rs b/src/transport/wire.rs index fe690a2..a6ca286 100644 --- a/src/transport/wire.rs +++ b/src/transport/wire.rs @@ -14,7 +14,7 @@ use super::{EncodedMessage, MessageKind, ParsedMessage}; /// The wire format's version, the first byte of every payload. Bump it with every change /// to a message type or a codec (`golden_bytes` fails then). -pub(crate) const VERSION: u8 = 18; +pub(crate) const VERSION: u8 = 21; /// What the second byte of a payload says. fn tag(kind: MessageKind) -> u8 { @@ -371,6 +371,7 @@ pub(crate) fn samples() -> Vec<ParsedMessage> { leaving: false, announcing: false, eager: false, + reaches: None, }; let proof = IdentityProof { key: [8; 32], @@ -555,6 +556,7 @@ mod tests { leaving: false, announcing: false, eager: false, + reaches: None, }; let decoded = decode(&encode(&ParsedMessage::StatusReply(status.clone())).unwrap()).unwrap(); @@ -580,6 +582,7 @@ mod tests { leaving: false, announcing: false, eager: false, + reaches: None, }; assert!(decode(&encode(&ParsedMessage::Status(status)).unwrap()).is_err()); } @@ -679,10 +682,11 @@ mod tests { leaving: false, announcing: true, eager: false, + reaches: None, }); assert_eq!( hex(&encode(&status).unwrap()), - format!("{v}03989290c400{epoch_hex}01c3c2c2c3c2") + format!("{v}03999290c400{epoch_hex}01c3c2c2c3c2c0") ); let who = ParsedMessage::Who(IdentityProof { |
