aboutsummaryrefslogtreecommitdiffstats
path: root/src/transport
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport')
-rw-r--r--src/transport/libp2p/tests.rs1
-rw-r--r--src/transport/mod.rs4
-rw-r--r--src/transport/mycelium/mod.rs1
-rw-r--r--src/transport/paths.rs1
-rw-r--r--src/transport/sim.rs1
-rw-r--r--src/transport/wire.rs8
6 files changed, 14 insertions, 2 deletions
diff --git a/src/transport/libp2p/tests.rs b/src/transport/libp2p/tests.rs
index 0f52e23..1d7c6ac 100644
--- a/src/transport/libp2p/tests.rs
+++ b/src/transport/libp2p/tests.rs
@@ -59,6 +59,7 @@ fn status() -> ParsedMessage {
ready: true,
syncs_with_you: false,
leaving: false,
+ announcing: false,
})
}
diff --git a/src/transport/mod.rs b/src/transport/mod.rs
index b8b57af..25f9b7c 100644
--- a/src/transport/mod.rs
+++ b/src/transport/mod.rs
@@ -202,6 +202,10 @@ pub(crate) struct Status {
/// The sender is shutting down: its farewell (`keepalive::farewell`). The
/// recipient holds it dormant at once, rather than after `dormant_after` of silence.
pub(crate) leaving: bool,
+ /// The sender announces new heads (`swarm::relay`), rather than keeping alive: a
+ /// STATUS answered only if the recipient's heads differ. Most announcements reach a
+ /// neighbour that has the changes already, which has nothing to tell.
+ pub(crate) announcing: bool,
}
/// Cheap to clone: large parts are shared (`bytes::Bytes`).
diff --git a/src/transport/mycelium/mod.rs b/src/transport/mycelium/mod.rs
index 9078134..9850ef0 100644
--- a/src/transport/mycelium/mod.rs
+++ b/src/transport/mycelium/mod.rs
@@ -717,6 +717,7 @@ mod tests {
ready: true,
syncs_with_you: true,
leaving: false,
+ announcing: false,
};
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 164574d..29b3c23 100644
--- a/src/transport/paths.rs
+++ b/src/transport/paths.rs
@@ -1513,6 +1513,7 @@ mod tests {
ready: false,
syncs_with_you: false,
leaving: false,
+ announcing: false,
})
}
diff --git a/src/transport/sim.rs b/src/transport/sim.rs
index 2f167dc..7a679fc 100644
--- a/src/transport/sim.rs
+++ b/src/transport/sim.rs
@@ -387,6 +387,7 @@ mod tests {
ready: true,
syncs_with_you: false,
leaving: false,
+ announcing: false,
})
}
diff --git a/src/transport/wire.rs b/src/transport/wire.rs
index d72fba4..d3bf39d 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 = 15;
+pub(crate) const VERSION: u8 = 16;
/// What the second byte of a payload says.
fn tag(kind: MessageKind) -> u8 {
@@ -369,6 +369,7 @@ pub(crate) fn samples() -> Vec<ParsedMessage> {
ready: true,
syncs_with_you: true,
leaving: false,
+ announcing: false,
};
let proof = IdentityProof {
key: [8; 32],
@@ -549,6 +550,7 @@ mod tests {
ready: true,
syncs_with_you: false,
leaving: false,
+ announcing: false,
};
let decoded =
decode(&encode(&ParsedMessage::StatusReply(status.clone())).unwrap()).unwrap();
@@ -572,6 +574,7 @@ mod tests {
ready: true,
syncs_with_you: true,
leaving: false,
+ announcing: false,
};
assert!(decode(&encode(&ParsedMessage::Status(status)).unwrap()).is_err());
}
@@ -669,10 +672,11 @@ mod tests {
ready: true,
syncs_with_you: false,
leaving: false,
+ announcing: true,
});
assert_eq!(
hex(&encode(&status).unwrap()),
- format!("{v}03969290c400{epoch_hex}01c3c2c2")
+ format!("{v}03979290c400{epoch_hex}01c3c2c2c3")
);
let who = ParsedMessage::Who(IdentityProof {